Reputation: 63
My default url home page is http://www.brindesbb.com/Pages/Default.aspx.
but I dont want to show Pages/Default.aspx
in the address bar.
can anyone suggest me how to replace the url without reloading (refreshing ) the page.
Thanks in advance
Upvotes: 1
Views: 3722
Reputation: 579
Technically that not possible with .net as .net is used on server side. and you need to change the URL which is on client side so... you will need to use JavaScript to manipulate the Browser URL history. Example [asp.net mvc] my url is http://localhost:123/Home/Product
and I need to change it to
http://localhost:123/Home/Product/301
this can be achieved by
<script>
window.history.pushState('', 'My Page', 'Home/Product/301');
</script>
Upvotes: 0
Reputation: 7630
What you want to do is URL Rewriting, read more here URL Rewriting in ASP.NET
Update: If you setup a new website(or edit the one you have) and point the /Pages directory as "root" and aspx is an default document the url will be as you want.
Upvotes: 1
Reputation: 1238
You can do so in two ways IIS URL Rewriting and ASP.NET Routing
http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/
Upvotes: 1