简体   繁体   English

Asp.net 2.0从网址隐藏Default.aspx

[英]Asp.net 2.0 Hide Default.aspx from Url

I have one issue with my site. 我的网站有一个问题。 I need to hide Default.aspx from Url. 我需要从URL隐藏Default.aspx。 My web site project uses urlrewriter net and I tried using it to make this but no success. 我的网站项目使用urlrewriter net,但我尝试使用它来实现此目的,但没有成功。

I read lot of articles on net how to do this but nothings work. 我在网上阅读了很多文章,但是却无济于事。

Does this is only possible to set on IIS ? 这只能在IIS上设置吗?

I wont all ways to have www.test.com instead of www.test.com/default.aspx 我不会以所有方式拥有www.test.com而不是www.test.com/default.aspx

Please for best solution ? 请寻求最佳解决方案?

If you're using iis 7 or above, this might be a way of going about it. 如果您使用的是IIS 7或更高版本,这可能是解决问题的一种方法。

The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find. 用于IIS 7及更高版本的Microsoft URL重写模块2.0使IIS管理员可以创建功能强大的自定义规则,以将请求URL映射到友好的URL,这些URL易于用户记住并且易于搜索引擎查找。 You can use the URL Rewrite module to perform URL manipulation tasks. 您可以使用URL重写模块执行URL操作任务。

http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

And heres a link to see the module in action. 还有一个链接,供您查看实际使用的模块。 http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

After reading tons of articles this is solution for my problem.. setting this javascript onto masterpage 阅读大量文章后,这是解决我的问题的方法。

var testremove = location.href.toLowerCase().indexOf("default.aspx");
if (testremove != -1) {location.replace(location.href.substring(0,testremove))};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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