相關(guān)資訊
本類常用軟件
-
福建農(nóng)村信用社手機銀行客戶端下載下載量:584204
-
Windows優(yōu)化大師下載量:416896
-
90美女秀(視頻聊天軟件)下載量:366961
-
廣西農(nóng)村信用社手機銀行客戶端下載下載量:365699
-
快播手機版下載量:325855
最近有人問過這樣的問題“ASPnet_client必須放在Web根目錄嗎?怎樣改變這個路徑?”,現(xiàn)在就特地分享這篇文章給大家,教你自定義aspnet_client路徑的方法。希望能夠幫助到各位。
有人發(fā)帖問“ASPnet_client必須放在Web根目錄嗎?怎樣改變這個路徑?”
我一開始猜想這個路徑可能是硬編碼的。為了證實一下,就打開了Reflector,試圖尋找到類似"/aspnet_client/system_web/1_1_4322/"的字符串,卻發(fā)現(xiàn)這個目錄的位置是可以自定義的,但是MSDN中沒有公開。相關(guān)代碼在System.Web.UI.Util.GetScriptLocation(HttpContext)中,
1internal static string GetScriptLocation(HttpContext context)
2...{
3 string text1 = null;
4 IDictionary dictionary1 = (IDictionary) context.GetConfig("system.web/webControls");
5 if (dictionary1 != null)
6 ...{
7 text1 = (string) dictionary1["clientScriptsLocation"];
8 }
9 if (text1 == null)
10 ...{
11 throw new HttpException(HttpRuntime.FormatResourceString("Missing_clientScriptsLocation"));
12 }
13 if (text1.IndexOf("{0}") >= 0)
14 ...{
15 string text2 = "system_web";
16 string text3 = VersionInfo.ISAPiVersion.Substring(0, VersionInfo.IsapiVersion.LastIndexOf('.')).Replace('.', '_');
17 text1 = string.Format(text1, text2, text3);
18 }
19 return text1;
20}
然后再machine.config中找到了默認(rèn)的配置:
<webControls clientScriptsLocation="/aspnet_client/{0}/{1}/" />
當(dāng)然也可以在web.config中針對單個應(yīng)用程序進(jìn)行配置。如果要把aspnet_client目錄放在根目錄下的myweb中,那么就在web.config文件的
<configuration>
<system.web>
標(biāo)簽內(nèi)加上這么一句:
<webControls clientScriptsLocation="/myweb/aspnet_client/{0}/{1}/" />
或者直接寫
<webControls clientScriptsLocation="/myweb/aspnet_client/system_web/1_1_4322/" />
就可以了。