2011-01-19 128 views
1

我是自己的URL路由。 主項目只包含URL路由代碼。 不同的網站被放置在approot上。 例如:我已經在approot/webTest /上部署了VS2010 test-default-website。 我試圖從瀏覽器打開http://webTest/Account/Login.aspx。 對於URL請求,我使用PageParser.GetCompiledPageInstance()服務頁面,如下所示:asp.net更改網站根目錄

在URL路由請求處理程序,

回報PageParser.GetCompiledPageInstance( 「WebTest的/帳號/的Login.aspx」 的HttpContext .Current.Server.MapPath(「webTest/Account/Login.aspx」), HttpContext.Current);

我得到以下異常:

文件 '/Account/webTest/Account/Login.aspx' 不存在。

PageParser.GetCompiledPageInstance在實際地址前自動附加'/ Account',因此無法找到它。 我怎樣才能讓它不會追加'/賬戶'?

謝謝。 最好的問候。

回答

0

"webTest/Account/Login.aspx"是相對路徑,斜線添加到開始,使之絕對的:"/webTest/Account/Login.aspx"

+0

非常感謝你阿爾喬姆:d,你救我的一天:) – 2011-01-19 15:47:53