asp.netÉÏ´«ÎļþС½á
£¼input id = " loFile " type = " file " runat = " server " £¾
£¼form method = " post " enctype =" multipart/form-data " runat = " server "£¾
£¼/form £¾
1.»ñµÃÉÏ´«ÎļþµÄÃû³Æ£º£¨¹Ø¼üÊÇPostedFileÀàµÄÓ¦Óã©
ʹÓÃPathÀàÖеÄGetFileName·½·¨£¬¾ßÌåÈçÏ£º
lstrFileName = loFile.PostedFile.FileName
¡¡¡¡' ×¢£º loFile.PostedFile.FileName ·µ»ØµÄÊÇͨ¹ýÎļþ¶Ô»°¿òÑ¡ÔñµÄÎļþÃû£¬
¡¡¡¡ÕâÖ®Öаüº¬ÁËÎļþµÄĿ¼ÐÅÏ¢
lstrFileName = Path.GetFileName ( lstrFileName )
¡¡¡¡' È¥µôĿ¼ÐÅÏ¢£¬·µ»ØÎļþÃû³Æ
£¨2£©. ÅжÏÉÏ´«Ä¿Â¼ÊÇ·ñ´æÔÚ£¬²»´æÔھͽ¨Á¢
¡¡¡¡½¨Á¢Ä¿Â¼ÒªÊ¹Óõ½DirectoryÀàÖÐµÄ CreateDirectory ·½·¨£¬ÅжÏĿ¼ÊÇ·ñ´æÔÚÒªÓõ½ Directory ÀàÖеÄExists·½·¨¡£¾ßÌåÈçÏ£º
If ( not Directory.Exists( lstrFileFolder ) ) Then
¡¡Directory.CreateDirectory ( lstrFileFolder )
End If
¡¡' ×¢£ºlstrFileFolderÊÇÓû§ÌîÈëµÄĿ¼Ãû³Æ£¬»òÕßÊÇȱʡµÄĿ¼Ãû³Æ
¡¡¡¡£¼ËÄ£¾£®ÉÏ´«Ñ¡¶¨Îļþµ½·þÎñÆ÷ÉÏ
¡¡¡¡ÔÚÇ°Ã湤×÷¶¼ÒѾÍê³ÉÒԺ󣬾ͿÉÒÔÉÏ´«ÎļþÁË£¬ÉÏ´«ÎļþÏà¶Ô±È½Ï¼òµ¥£¬¾ÍÓÃÏÂÃæ2ÐÐÓï¾ä¾Í¿ÉÒÔÍê³ÉÉÏ´«¹¤×÷¡£
lstrFileNamePath = lstrFileFolder & lstrFileName
¡¡' µÃµ½ÉÏ´«Ä¿Â¼¼°ÎļþÃû³Æ
loFile.PostedFile.SaveAs ( lstrFileNamePath )
¡¡'ÉÏ´«Îļþµ½·þÎñÆ÷
¡¡¡¡£¼Î壾£®»ñµÃ²¢ÏÔʾÉÏ´«ÎļþµÄÊôÐÔ
FileName.Text = lstrFileName
¡¡' »ñµÃÎļþÃû³Æ
FileType.Text = loFile.PostedFile.ContentType
¡¡'»ñµÃÎļþÀàÐÍ
FileLength.Text = cStr ( loFile.PostedFile.ContentLength )
¡¡'»ñµÃÎļþ³¤¶È
FileUploadForm.visible = false
AnswerMsg.visible = true
¡¡'ÏÔʾÉÏ´«ÎļþÊôÐÔ
£¼% @ Import Namespace=" System.IO " %£¾
£¼html £¾
£¼BODY £¾
£¼SCRIPT LANGUAGE = "VB" RUNAT = "SERVER" £¾
¡¡Sub UploadFile_Clicked ( Sender as Object, e as EventArgs )
¡¡¡¡Dim lstrFileName as string
¡¡¡¡Dim lstrFileNamePath as string
¡¡¡¡Dim lstrFileFolder as string
¡¡¡¡' Èç¹ûÉÏ´«Ä¿Â¼Îª¿Õ£¬¾ÍʹÓÃ" c:\ "×÷ΪȱʡÉÏ´«Ä¿Â¼
¡¡¡¡' »ñµÃÉÏ´«µ½·þÎñÆ÷µÄĿ¼Ãû³Æ
¡¡¡¡if dir.value £¼£¾ "" then
¡¡¡¡¡¡lstrFileFolder = dir.value
¡¡¡¡else
¡¡¡¡¡¡lstrFileFolder = "c:\"
¡¡¡¡end if
¡¡¡¡' »ñµÃÎļþÃû³Æ
¡¡¡¡lstrFileName = loFile.PostedFile.FileName
¡¡
Ïà¹ØÎĵµ£º
ÔÎÄ£ºÁõÎä|ASP.NETÈçºÎµ¼³öexcel£¨Ò»£©
ASP.NETÖе¼³öexcelµÄ·½·¨ºÜ¶à£¬×î¼òµ¥µÄ¾ÍÊÇÀûÓ÷þÎñÆ÷¿Ø¼þµÄRenderControl·½·¨£¬Ëû¿ÉÒÔ°Ñ·þÎñÆ÷¿Ø¼þµÄÄÚÈÝ×÷ΪÁ÷Êä³öµ½¿Í»§¶Ë£¬¿ÉÒÔÓø÷½·¨Êä³öÕû¸öÒ³Ã棬Ҳ¿ÉÒÔÊä³öµ¥¶ÀµÄ¿Ø¼þ¡£µ¥±ØÐë×¢ÒâʹÓø÷½·¨Ê±±ØÐëÖØÔØ VerifyRenderingInServerForm º¯Êý£¬·ñÔò¾Í»á³ö´í¡£ÒÔÏÂÊÇ ......
<a>±êÇ©
1. <a href=”test.aspx”></a>
2. ÕâÊÇ×î³£¼ûµÄÒ»ÖÖתÏò·½·¨;
HyperLink¿Ø¼þ
1. Asp.net ·þÎñÆ÷¶Ë¿Ø¼þ ÊôÐÔNavigateUrlÖ¸¶ ......
1 response.redirect Õâ¸öÌøתҳÃæµÄ·½·¨ÌøתµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø£¨2´Îpostback£©£¬µ«Ëû¿ÉÒÔÌøתµ½ÈκÎÒ³Ã棬ûÓÐÕ¾µãÒ³ÃæÏÞÖÆ£¨¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË£©£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ£¡redirectÌøת»úÖÆ£ºÊ×ÏÈÊÇ·¢ËÍÒ»¸ö httpÇëÇ󵽿ͻ§¶Ë£¬Í¨ÖªÐèÒªÌøתµ½ÐÂÒ³Ã棬Ȼºó¿Í»§¶ËÔÚ·¢ËÍÌøתÇëÇóµ½·þÎ ......
ASP.NET³ÌÐòÖг£ÓõÄÈýÊ®ÈýÖÖ´úÂë.......................................
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
......
ASP.NET 2.0 ÖÐÐÂÔö¼ÓÁË Theme µÄ¹¦ÄÜ£¬ËüµÄ³öÏÖÄÜÈÃÍøվʵÏÖ»»·ô¸ü¼ÓÈÝÒס£
Theme µÄʵÏÖ°üÀ¨£ºCSS¡¢Skin¡¢MasterPage¡£
CSS ÊÇÓÃÓÚ¿ØÖÆËùÓÐ HTML ±ê¼ÇµÄÍâ¹Û¡£
Skin ÊÇÓÃÓÚ¿ØÖÆËùÓÐ ASP.NET ·þÎñÆ÷µ÷ÕûµÄÍâ¹Û£¬²¢ÇÒ¿ÉÒÔͨ¹ýÊôÐÔ cssClass ¶¨ÒåËüµÄ CSS Ñùʽ¡£
MasterPage ÊÇ *.aspx Ò³ÃæÄ£°æ£¬²»¹ýËüûÓỶ¨Òåµ½ The ......