[英]hide page url asp.net
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 我想出现所有这样的网站:www.mysite.com
How can I do this in asp.net 3.5 with IIS 6.0. 如何在带有IIS 6.0的asp.net 3.5中执行此操作。
Thanks 谢谢
参见ScottGu对此问题的解释: 技巧:使用ASP.NET进行网址重写
use ajax to load your content or use one big <frameset>
. 使用ajax加载您的内容或使用一个大的
<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.
这将打破用户制作书签的可能性,使Google很难/不可能爬网您的网站。
Obfuscating the actual URL is very bad practice both in usability and debugging. 在可用性和调试上,混淆实际URL是非常不好的做法 。
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. 如果确实需要这样做,则可以使用HTML框架,方法是在所需的URL上放置父框架集页面,并在框架集内的全角全高框架中放置实际页面。
http://www.w3.org/TR/WD-frames-970331 http://www.w3.org/TR/WD-frames-970331
how do you identify what page you should use? 您如何确定应该使用哪个页面?
Your could use url rewriting module(iis) for friendly urls like these: 您可以将网址重写模块(iis)用于友好的网址,如下所示:
www.mysite.com/page/1 www.mysite.com/page/1
www.mysite.com/page/2 www.mysite.com/page/2
www.mysite.com/page/3 www.mysite.com/page/3
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:
我绝对不推荐这种方法,因为它很丑陋,但可能会完成工作:
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 在www.mysite.com/page[1|2|3].aspx Page_Load方法上,仅当Request.UrlReferrer不是www.mysite.com/时,才发出Response.Redirect(“ www.mysite.com/”)。页面[1 | 2 | 3] .aspx
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. 如果Request.UrlReferrer是www.mysite.com/page [1 | 2 ||,则在www.mysite.com/[default.aspx]上发出Server.Transfer(“ page [1 | 2 | 3] .aspx”)。 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.
Server.Transfer将拉动服务器端的页面并响应结果,而不是发出301重定向,因此用户仍将在其浏览器上看到www.mysite.com/。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.