ASP.NET·¾¶ÎÊÌâС½á
1.·ûºÅ“/”Ö¸³ÌÐòÔËÐÐËùÔÚ¸ùĿ¼£¬¼´IIsËùÔÚĿ¼¡£
Èç¹ûiisËùÔÚĿ¼Ϊ£ºd:\programs
½â¾ö·½°¸Îªd:\programs\d
Íøվ·¾¶Îª£ºd:\programs\d\web\
·ûºÅ“/”´ú±íµÄÊÇ£ºd:\programs£¬²»¹ÜÄãµÄÍøվǰÃæÓжàÉÙ¼¶£¬¶¼Ó¦¸Ã×÷Ϊһ¸öÕûÌå¡£
2.·ûºÅ“~/”£¬ÔòÊÇÖ¸ÍøÕ¾ËùÔÚ¸ùĿ¼¡£¼´d:\programs\d\web¡£
²âÊÔ´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(Server.MapPath("/"));
Response.Write("<br/>");
Response.Write(Server.MapPath("~/"));
}
Êä³ö½á¹û£º
C:\inetpub\wwwroot\
D:\Programs2008\WebSite2\
Ïà¹ØÎĵµ£º
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 AlltripDLL;
public pa ......
½¡¿µ×´¿ö¼àÊӵij£ÓÃÊõÓ
ÇëÇó
ÏìÓ¦
ÐéÄâÓû§£ºÄ£Äâä¯ÀÀÆ÷ÏòWeb·þÎñÆ÷·¢ËÍÇëÇó²¢½ÓÊÕÏìÓ¦µÄÒ»¸ö½ø³Ì»òÏ̡߳£
ÏìӦʱ¼ä£ºä¯ÀÀÆ÷ÏòWeb·þÎñÆ÷Ìá½»Ò»¸öÇëÇóµ½ÊÕµ½ÏìÓ¦Ö®¼äµÄ¼ä¸ôʱ¼ä¡£
˼¿¼Ê±¼ä£ºä¯ÀÀÆ÷ÔÚÊÕµ½ÏìÓ¦ºóµ½Ìá½»ÏÂ
Ò»¸öÇëÇóÖ®¼äµÄ¼ä¸ôʱ¼ä¡£
ÇëÇó³É¹¦ÂÊ£ºWeb·þÎñÆ÷ÕýÈ·´¦ÀíµÄÇëÇóÊýÁ¿ºÍ½ÓÊÕµ½µÄÇëÇóÊýÁ¿µÄ±È¡ ......
ÔÚGlobal.asaxÖе¼ÈëÃüÃû¿Õ¼ä
<%@Global ...
<%@Import Namespace= "System.Data " %>
<%@Import& ......
Private static readonly object ReflectionLock = new object();
Lock (ReflectionLock)
{
Type scriptManagerType =
Type.GetType(
"System.Web.UI.ScriptManager, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35",
false);
......
public static void GetHtml(string url,string savepath)//url²ÎÊýΪ½«ÒªÉú³ÉµÄÄǸö¶¯Ì¬Ò³ÃæµÄµØÖ·£¬savepathΪҪ´æ·ÅµØÖ·
{
string Result;
WebResponse MyResponse;
WebRequest MyRequest = System.Net.HttpWebRequest.Create(url);
MyResponse = MyReque ......