.NET 4.0中的URL重写 [英] url rewriting in .net 4.0

查看:82
本文介绍了.NET 4.0中的URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp.net 4.0和iis7.我正在使用Intelligencia dll执行URL重写.我有一个用户控件,其中包含指向不同页面的链接.在web.config文件中,我已经编写了以下代码

I am using asp.net 4.0 and iis 7. I am using Intelligencia dll to perform url rewriting . I have a user control which has the links to different pages. in web.config file i have written below code

<rewriter>
    <rewrite url="~/(Product1/)*" to="~/Product.aspx?category=$1" />
  </rewriter>


用于urlrewriting.它只是第一次正常工作,但从下一页加载开始.网址被重写,另一个/Product附加在链接中.
链接第一次是 http://localhost:1789/WebSite1/Product1/DVD http://localhost:1789/WebSite1/Product1/Product1/DVD .

每次页面加载都会添加Product1单词.


for urlrewriting. it just works fine first time but from next page load. the url is rewritten and another /Product gets appended in the link.
For first time the link is http://localhost:1789/WebSite1/Product1/DVD
but after i click on this link second time onwards the link is http://localhost:1789/WebSite1/Product1/Product1/DVD.

The Product1 word is getting added for every page load.

推荐答案

1" / > < /rewriter >
1" /> </rewriter>


用于urlrewriting.它只是第一次正常工作,但从下一页加载开始.网址被重写,另一个/Product附加在链接中.
链接首次为 http://localhost:1789/WebSite1/Product1/DVD http://localhost:1789/WebSite1/Product1/Product1/DVD .

每次页面加载都会添加Product1单词.


for urlrewriting. it just works fine first time but from next page load. the url is rewritten and another /Product gets appended in the link.
For first time the link is http://localhost:1789/WebSite1/Product1/DVD
but after i click on this link second time onwards the link is http://localhost:1789/WebSite1/Product1/Product1/DVD.

The Product1 word is getting added for every page load.


请尝试以下代码..

hi , please try below code..

<rewriter>
    <rewrite url=" ../(Product1/)*" to=" ../Product.aspx?category=


1" /> </rewriter>
1" /> </rewriter>


这篇关于.NET 4.0中的URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆