Tarun
Tarun

Reputation: 267

How to change URL name in browser using asp.net

I have a situation in which there is a login page.After successfully logging in,i 'm redirected to http:\localhost\default.aspx.I want that after logging in my browser url should look like www.abc.com but the pa ge opened would be http:\localhost\default.aspx.I'm not able to do this using URL rewriting

Upvotes: 0

Views: 2447

Answers (3)

nano
nano

Reputation:

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

Upvotes: 0

Jon Grant
Jon Grant

Reputation: 11520

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.

Upvotes: 0

JBRWilkinson
JBRWilkinson

Reputation: 4875

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'.

Upvotes: 2

Related Questions