如何进行动态查询字符串的url重写? [英] How to do url rewriting of dynamic query strings?
问题描述
大家好,
我正在尝试将带有查询字符串的URL转换为SEO字符串.我已经从 Urlwriter.net [ urlrewriter.net/ [ ^ ].我什至安装了Visual Studio 2008 sp1来使用其内置功能.遗憾的是,我尝试过的操作要求您在使用Response.Redirect
之前了解要传递的查询字符串.每次单击gridview都会从数据库中检索索引.
我的代码如下:
使用此代码重定向到页面时
Hello All,
I am trying to convert urls with query strings to SEO strings. I have already searched and used dlls from Urlwriter.net[^],urlrewriter.net/[^] .I even installed visual studio 2008 sp1 to use its inbuilt functions. Sadly the ones i tried require that you know about the query string that is to be passed prior to using Response.Redirect
. The Index is retrieved from database as per click on gridview.
My code looks like this:
On redirecting to a page by using this code
Response.Redirect("Details.aspx?ID=" + Index.ToString());
浏览器中的网址应显示
www.hom2e.com/details/
而不是
The url in the browser should show
www.hom2e.com/details/
rather than
<br />
www.hom2e.com/details.aspx?ID=43<br />
or<br />
www.hom2e.com/details.aspx?ID=26<br />
我已经在Codeproject和其他网站(例如 ^ ]
我正在使用Visual Studio 2008,IE9,Firefox 8.0. Windows 7
I have already searched and read articles in codeproject and other websites like Scottgu''s blog[^]
I am using Visual studio 2008, IE9,Firefox 8.0. windows 7
推荐答案
在.net 3.5中,这是一个内置功能.使用System.Web.Routine命名空间类,这一切变得非常简单明了.
通过波纹管链接
单击此处 [ ^ ]
In .net 3.5, this is an in-built feature. Using System.Web.Routine namespace classes, This all is made very simple and straight forward.
go through bellow link
click here[^]
string id = Index.ToString();
id = Request.QueryString["ID"];
如果Index = 5
,则上面的代码等效于Details.aspx?ID = 5
如果可以解决您的问题,请将其标记为正确的解决方案
最好的问候,
爱德华
The code above is equivalent to Details.aspx?ID=5 if Index = 5
Please mark this as correct solution if it solves your problem
Best regards,
Eduard
这篇关于如何进行动态查询字符串的url重写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!