我在 IIS 中创建了一个名为 wbsite1 的新网站。然后我向 website1 添加了一个应用程序,这是一个名为 website2 的网站。当我们尝试访问 website2 中的链接时出现问题。浏览器总是引用根 url 和重定向,所以我们试图更改 website2 中的所有 url。例如,如果我们在 website2 中有一个 url,例如:
<a href='http://localhost:2030/website2/cms/default.aspx...'
然后我们点击该链接,浏览器将我们重定向到:
http://localhost:2030/website1/default.aspx
为什么我会出现这种行为?在不试图弄乱网站中的每个链接的情况下集成两个网站的最佳解决方法是什么?非常感谢。
当我尝试访问子应用程序中的页面时,我们遇到了麻烦,它重定向到主应用程序的默认页面并给出错误:
Session state is not available in this context.
最佳答案
我找到了我的问题的解决方案,它是:
unfortunately i have to "rewrite" all our links in my code.
so i created a function which will automatically add prefix to external links,
and store base link for other site it configuration.
I did such project with success. thank u for all your replies
我还找到了另一个解决方案,它使用网络代理,但我不能在我的场景中使用它
关于c# - 子应用程序路径问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17107354/