ASP.NET Show Full Url in Browser for the Default Page

南笙酒味 提交于 2019-12-11 07:35:28

问题


When I set the Default Document in IIS to display my Default page (default.aspx), and access it using the host header I implemented; it only shows the host header address and not the full page address in the browser.

For example:

Host header: http://mysite IIS default document: /PageContainer/default.aspx

when I enter http://mysite through the browser; it opens the http://mysite/PageContainer/default.aspx but shows only the http://mysite address in the browser address bar.

How can I change it to show the full url like http://mysite/PageContainer/default.aspx in the browser address bar either.


回答1:


You could add a redirect for

http://mysite --> http://mysite/PageContainer/default.aspx



回答2:


You could add a default.aspx page in the root (i.e. http://mysite/default.aspx) with the following code and make 'default.aspx' the default document:

<html>
<head>
<meta http-equiv="refresh" content="0;URL=/PageContainer/default.aspx" />
</head>
<body></body>
</html>


来源:https://stackoverflow.com/questions/11720925/asp-net-show-full-url-in-browser-for-the-default-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!