ASP.NET FileUploadÓ¦ÓÃʵÀý
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ÎÞ±êÌâÒ³</title>
</head>
<body>
<form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="±ØÐëÊÇ jpg»òÕßgifÎļþ" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\W+)\$?)(\\(\W[\W].*))+(.jpg|.Jpg|.gif|.Gif){$article$}quot;></asp:RegularExpressionValidator>
</form>
</body>
</html>
Default.aspx.cs:
using System;
using System.Data;
using System.Configuration;
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;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String savePath = @"F:\111\";
if (FileUpload1.HasFile)
{
String filename;
&
Ïà¹ØÎĵµ£º
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
< ......
OAÔ´ÂëΪÎÒ¹¤×÷ÊÒ¾«ÐÄ´òÔì,ÓÃÁËÈýÄêµÄʱ¼ä,²ÅÐÞÕýÍêÉƵĴóÐͰ칫ϵͳ.
Ϊ¶ÀÁ¢¿ª·¢,²»´æÔÚ°æȨ¾À·×,²»»á¸øÄú´øÀ´Âé·³,´úÂëÍêÕû£¬Öø×÷ȨµÇ¼ÇºÅ£º2008SR14608.
OA×îÐÂÉý¼¶£¬¹¤×÷Á÷¸üÇ¿´ó£¬±íµ¥¶¨Òå¸üÎȶ¨
ÇëÈÏ×¼ÁªÏµ·½Ê½£¬½÷·À¼Ùð¡£
Ϊ½ÚÔ¼¿ª·¢³É±¾£¬OAÔ´Âë¿ÉÒÔ·ÖÄ£¿é½øÐÐÌṩ
ÓÀ¾Ãά»¤£¬Óг¥2´Î¿ª·¢
Èí¼þ¹¦ÄÜ·ÖΪרҵ° ......
Ò».Literal Web ·þÎñÆ÷¿Ø¼þ¸ÅÊö£¨ÕªÓÚMSDN£©
¿ÉÒÔʹÓà Literal Web ·þÎñÆ÷¿Ø¼þ×÷ΪҳÃæÉÏÆäËûÄÚÈݵÄÈÝÆ÷¡£Literal ×î³£ÓÃÓÚÏòÒ³ÃæÖж¯Ì¬Ìí¼ÓÄÚÈÝ¡£
Literal ¿Ø¼þ±íʾÓÃÓÚÏòÒ³ÃæÌí¼ÓÄÚÈݵļ¸¸öÑ¡ÏîÖ®Ò»¡£¶ÔÓÚ¾²Ì¬ÄÚÈÝ£¬ÎÞÐèʹÓÃÈÝÆ÷£¬¿ÉÒÔ½«±ê¼Ç×÷Ϊ HTML
Ö±½ÓÌí¼Óµ½Ò³ÃæÖС£µ«ÊÇ£¬Èç¹ûÒª¶¯Ì¬Ìí¼ÓÄÚÈÝ£¬Ôò±ØÐ뽫ÄÚÈÝÌí¼ ......
¡¡1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
¡¡¡¡Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
¡¡¡¡·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø± ......
·½·¨1:
±ÈÈ罨Á¢Ò»¸öÃûΪcnlive£¬ÖµÎª"123"µÄcookie
HttpCookie cookie = new HttpCookie["cnlive"];
cookie.Value = "123";
Response.AppendCookie(cookie);
È¡¸Õ²ÅдÈëµÄCookieÖµ:
HttpCookie cookie = Request.Cookies["cnlive"];
cookieValue = cookie.Value;
ÔÚÒ»¸öCookieÖд¢´æ¶à¸öÐÅÏ¢:
HttpCookie cookie ......