简体   繁体   中英

How to change URL name in browser using asp.net

我遇到的情况是有一个登录页面。成功登录后,我被重定向到http:\\ localhost \\ default.aspx。我希望登录后浏览器的网址应类似于www.abc.com,但打开的页面将是http:\\ localhost \\ default.aspx。我无法使用URL重写来执行此操作

Unfortunately, this is not possible for internet users - you can't 'fake' the URL that your user is looking at. Otherwise evil-doers could re-write 'www.istealyourmoney.com' as 'www.trustworthybank.com', etc.

The only possible option I can think of is if your users are all on the same local area network. In that case, you can add an entry to your HOSTS file with www.abc.com aliased to 'localhost'.

As said by JBRWilkinson this is not generally possible, however if you want to do this just to help you build out a site while you work on it locally, add an entry to your HOSTS file (on Windows: C:\\Windows\\System32\\Drivers\\Etc\\Hosts ) that maps www.abc.com to 127.0.0.1. You want to add a line that looks like this to the end of the file:

127.0.0.1    www.abc.com

Then you can access your local development website with the URL www.abc.com. Note that this will also block access to the live version of that website on your machine.

can't we achieve using IIS url rewrite? http://www.codinghorror.com/blog/archives/000797.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM