ÔÚASP.NETÖÐÉÏ´«Í¼Æ¬²¢Éú³ÉËõÂÔͼµÄC#Ô´Âë
http://www.knowsky.com/5723.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing.Imaging;
namespace eMeng.Exam
{
/// <summary>
/// Thumbnail µÄժҪ˵Ã÷¡£
/// </summary>
public class Thumbnail : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// ÔÚ´Ë´¦·ÅÖÃÓû§´úÂëÒÔ³õʼ»¯Ò³Ãæ
Label1.Text = "<h3>ÔÚASP.NETÀïÇáËÉʵÖËõÂÔÍ?lt;/h3>";
Button1.Text = "ÉÏÔز¢ÏÔʾËõÂÔͼ";
}
#region Web ´°ÌåÉè¼ÆÆ÷Éú³ÉµÄ´úÂë
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: ¸Ãµ÷ÓÃÊÇ ASP.NET Web ´°ÌåÉè¼ÆÆ÷Ëù±ØÐèµÄ¡£
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Éè¼ÆÆ÷Ö§³ÖËùÐèµÄ·½·¨ - ²»ÒªÊ¹ÓôúÂë±à¼Æ÷ÐÞ¸Ä
/// ´Ë·½·¨µÄÄÚÈÝ¡£
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
HttpFileCollection MyFileColl = HttpContext.Current.Request.Files;
HttpPostedFile MyPostedFile = MyFileColl[0];
if (MyPostedFile.ContentType.ToString().ToLower().IndexOf("image") < 0)
{
Response.Write("ÎÞЧµÄͼÐθñʽ¡£");
return;
}
GetThumbNail(MyPostedFile.FileName, 100, 100,
MyPostedFile.ContentType.ToString(), false, MyPostedFile.InputStream);
}
private System.Drawing.Imaging.ImageFormat GetImageType(object strContentType)
{
if ((strContentType.ToString().ToLower()) == "image/pjpeg")
{
return System.Drawing.Imaging.ImageFormat.Jp
Ïà¹ØÎĵµ£º
ÔÚʹÓÃÍøÕ¾¹ÜÀí¹¤¾ß×öµÇ¼ҳÃæµÄʱºòÓöµ½µÄÎÊÌâ
ËùÓöÎÊÌ⣺½øÈëVisual Studio 2005µÄ“ÍøÕ¾”²Ëµ¥µÄ“ASP.NET ÅäÖԺ󣬵ã»÷“°²È«”ºó£¬³öÏÖÈçϵijö´íÐÅÏ¢£º
“Ñ¡¶¨µÄÊý¾Ý´æ´¢Çø³öÏÖÎÊÌ⣬ÔÒò¿ÉÄÜÊÇ·þÎñÆ÷Ãû³Æ»òƾ¾ÝÎÞЧ£¬»òÕßȨÏÞ²»×ã¡£Ò²¿ÉÄÜÊÇ ......
ASP.Net 1.1ºóÒýÈëÁ˶ÔÌá½»±íµ¥×Ô¶¯¼ì²éÊÇ·ñ´æÔÚXSS(¿çÕ¾½Å±¾¹¥»÷)µÄÄÜÁ¦¡£µ±Óû§ÊÔͼÓÃÖ®ÀàµÄÊäÈëÓ°ÏìÒ³Ãæ·µ»Ø½á¹ûµÄʱºò£¬ASP.NetµÄÒýÇæ»áÒý·¢Ò»¸ö HttpRequestValidationExceptioin¡£Ä¬ÈÏÇé¿öÏ»᷵»ØÈçÏÂÎÄ×ÖµÄÒ³Ã棺
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
Server Error in '/YourApplicationPath' Application
A potentially dangerou ......
ÔÎĵØÖ·:http://blog.csdn.net/ChengKing/archive/2009/01/01/3678774.aspx
ÊôÐÔµÄÉè¼ÆʱÌØÐÔ
.NET Framework
Ϊ
¿Ø¼þÉè¼ÆʱÊôÐÔÌṩÁ˺ܶà·á¸»µÄÀ࣬ÕâЩÊôÐԵŦÄܷdz£Áé»î£¬¿ØÖÆ·¶Î§¹ã·º£¬±ÈÈç¿ÉÒÔ¿ØÖƸÃÊôÐÔÔÚÊôÐÔ´°¿ÚÖеÄÏÔʾģʽ£¬È磺ÊÇ·ñÔÚÊôÐÔ´°¿ÚÖÐÏÔʾ¸ÃÊô
ÐÔ£¬Ò²¿ÉÒÔÖ¸¶¨´ËÊôÐÔ±ØÐë½ÓÊÕÖµÀàÐÍÃèÊö£¬°´×é· ......
ÔÚѧϰ±»Í£ÖÍÁËN¾ÃÒԺ󣬽ñÌìÖÕÓÚ϶¨¾öÐÄÒª¼ÌÐøÁË¡£¹ýÁËÌ«¾Ã¶éÂäµÄÉú»îÒ²¿ªÊ¼Ñá¾ëÁË¡£¼ÌÐø¿ªÊ¼ÎÒµÄMVCѧϰ֮·¡£ Ŀ¼»ú¹¹£º models Îļþ¼Ð£º Ä£ÐÍ×é¼þ »¹¿ÉÒÔ´æ·ÅÓйØÊý¾Ý·ÃÎʲÙ×÷µÄһЩÀà¡¢¶ÔÏóµÄ²Ù×÷µÄ¶¨ÒåµÈ¡£ Views Îļþ¼Ð£º ÊÓͼ×é¼þ¡£¿ÉÒÔ´æ·ÅµÄÎļþÀàÐÍ°üÀ¨.aspxÒ³Ã棬.ascx¿Ø¼þÒÔ¼°.mas ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using ......