【问题标题】:asp.net changing website rootasp.net 更改网站根目录
【发布时间】:2011-01-19 15:28:06
【问题描述】:

我自己是 URL 路由。 主项目仅包含 URL 路由代码。 不同的网站放在approot上。 例如:我在 approot/webTest/ 部署了 VS2010 test-default-website。 我正在尝试从浏览器打开http://webTest/Account/Login.aspx。 对于该 URL 请求,我正在使用 PageParser.GetCompiledPageInstance() 提供页面,如下所示:

在 URL 路由请求处理程序中,

return PageParser.GetCompiledPageInstance("webTest/Account/Login.aspx", HttpContext.Current.Server.MapPath("webTest/Account/Login.aspx"), HttpContext.Current);

我收到以下异常:

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

PageParser.GetCompiledPageInstance 会自动在实际地址前附加“/Account”,因此无法找到。 我怎样才能让它不附加'/Account'?

谢谢。 最好的问候。

【问题讨论】:

    标签: asp.net url-routing


    【解决方案1】:

    "webTest/Account/Login.aspx"是相对路径,开头加斜杠使其绝对:"/webTest/Account/Login.aspx"

    【讨论】:

    • 非常感谢 Artem :D,你拯救了我的一天 :)
    猜你喜欢
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2011-08-23
    • 2015-07-11
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    相关资源
    最近更新 更多