ÔÚ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
Ïà¹ØÎĵµ£º
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öеķ½·¨TransmitFileÀ´½â¾öʹÓÃResponse.BinaryWrite
&nbs ......
½«ViewState³Ö¾Ã»¯±£³ÖÔÚ·þÎñÆ÷¶ËÎļþµÄ´úÂ룬ÕâÑùViewState²»Õ¼ÓÃÍøÂç´ø¿í£¬Òò´ËÆä´æÈ¡Ö»ÊÇ·þÎñÆ÷µÄ´ÅÅ̶Áȡʱ¼ä¡£²¢ÇÒËüºÜС£¬¿ÉÒÔ˵ÊÇ´ÅÅÌËæ±ãתһȦ¾ÍÄÜͬʱ¶ÁÈ¡ºÃ¶àViewState£¬Òò´Ë¿ÉÒÔ˵“²»Õ¼Ê±¼ä”¡£ÎªÁËÔÙ“²»Õ¼´ÅÅÌʱ¼ä”£¬ÎÒ»¹Ê¹ÓÃÁË»º´æ¡£
´´½¨Ò»¸ö»ùÀà:
public class
BasePage : Sys ......
using System;
using System.Web;
using System.Text.RegularExpressions;
public static string NoHTML(string Htmlstring)
{
//ɾ³ý½Å±¾
Htmlstring = Regex.Replace(Htmlstring,@"<script[^>]*?>.*?&l ......
ÔÎĵØÖ·:http://blog.csdn.net/ChengKing/archive/2009/01/01/3678774.aspx
ÊôÐÔµÄÉè¼ÆʱÌØÐÔ
.NET Framework
Ϊ
¿Ø¼þÉè¼ÆʱÊôÐÔÌṩÁ˺ܶà·á¸»µÄÀ࣬ÕâЩÊôÐԵŦÄܷdz£Áé»î£¬¿ØÖÆ·¶Î§¹ã·º£¬±ÈÈç¿ÉÒÔ¿ØÖƸÃÊôÐÔÔÚÊôÐÔ´°¿ÚÖеÄÏÔʾģʽ£¬È磺ÊÇ·ñÔÚÊôÐÔ´°¿ÚÖÐÏÔʾ¸ÃÊô
ÐÔ£¬Ò²¿ÉÒÔÖ¸¶¨´ËÊôÐÔ±ØÐë½ÓÊÕÖµÀàÐÍÃèÊö£¬°´×é· ......
ÓÃASP.NETÓÐÒ»¶Îʱ¼äÁË£¬µ«×ܾõµÃ»¹ÊÇÒ»Ö±¸¡ÓÚ±íÃ棬¶Ô¿Ø¼þ¿ª·¢ÖªÖ®ÉõÉÙ£¬¹Ê½üÆÚ¿ªÊ¼¶ñ²¹Õâ·½ÃæµÄÄÚÈÝ¡£ÒªÅÜÌâÁË£¬»¹ÊÇÏȻعËÒ»ÏÂÓ¦¸ÃÈçºÎÉÏÊÖASP.NET£¬¸ø¸Õ¿ªÊ¼½Ó´¥ËüµÄͬ־һµãÖ¸Òý£º
1¡¢ÅªÇå³þʲôÊÇ.NET£ºËµ°×ÁËËü¾ÍÊÇÒ»Ì׿ؼþ°ü£¬Ò»°ã±»Ëµ³É¿ò¼Ü£¬ÀàËÆÓÚMFC»òÕßDELPHIµÄVCLµÈµ ......