1

I want to hide page name in browser.

For example;

www.mysite.com/page1.aspx
www.mysite.com/page2.aspx
www.mysite.com/page3.aspx

I want to appear all sites like this: www.mysite.com

How can I do this in asp.net 3.5 with IIS 6.0.

Thanks

2
  • 2
    What is the purpose of this? I would recommend against it as whatever result you are trying to achieve can probably be achieved in a better way Commented Feb 21, 2011 at 15:39
  • 'www.mysite.com/' is not a valid virtual path. error ?? Commented Feb 22, 2011 at 12:04

6 Answers 6

3

See ScottGu's explanation about this issue here : Tip/Trick: Url Rewriting with ASP.NET

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But I m looking for a simple solution than this. I have just these 3 pages.
Possible I misunderstand what you want. But is it really difficult to write one function for this issue following the first approach mentioned in this article, for example?
2

use ajax to load your content or use one big <frameset>.

But, don't do it. It will break the possibility for users to make bookmarks, make it harder / impossible for Google to crawl your website.

1 Comment

Agreed. Avoid the <frameset> at all costs. It also does not play nicely on mobile devices.
2

Obfuscating the actual URL is very bad practice both in usability and debugging.

If you really, really need to do it you can use HTML frames by having a parent frameset page at your desired url and your actual pages in a full-width full-height frame inside the frameset.

http://www.w3.org/TR/WD-frames-970331

Comments

0

You can use Uri. Create a new Uri object and then use the Host method.

Comments

0

how do you identify what page you should use?

Your could use url rewriting module(iis) for friendly urls like these:

www.mysite.com/page/1

www.mysite.com/page/2

www.mysite.com/page/3

1 Comment

Thanks. But I m looking for a simple solution than this. I have just these 3 pages. I dont want to display page name in address bar.
0

If you are desperate and having trouble with other options you could do the follow. I definitely wouldn't recommend this approach because it's ugly but it would probably get the job done:

  1. On www.mysite.com/page[1|2|3].aspx Page_Load method, issue a Response.Redirect("www.mysite.com/") if and only if Request.UrlReferrer is not www.mysite.com/page[1|2|3].aspx

  2. On www.mysite.com/[default.aspx], issue a Server.Transfer("page[1|2|3].aspx") if the Request.UrlReferrer is www.mysite.com/page[1|2|3].aspx. Server.Transfer will pull the page on the server side and respond with the result, rather than issuing a 301 redirect so the user will still see www.mysite.com/ on their browser.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.