Hi everyone I have problem regarding dynamic url rewritting in asp.net. I am working on some site where i am passing querystring and on behalf of querystring i have to get name etc now i have return code on global.aspx page on application_beginrequest and code is below:
if i type www.peopleforever.org/profile.aspx?uid=9 it should be written like www.peopleforever.org/profile.aspx/Prakash
if (HttpContext.Current.Request.Path.ToLower().Contains("/profiles.aspx"))
{
string userid = Request.QueryString["uid"];
string name = utility.GetName(userid);
name = name.Replace(" ", "_");
Context.RewritePath("~/Profiles.aspx/" + name);
Context.Response.Status = "301 Moved Permanently";
Context.Response.AddHeader("Location", Context.Request.Url.AbsolutePath);
}
Now first time it get correct querystring and give correct url but after that it goes to infinite loop and after coming of this loop querystring doesn't
have value and and i need to querystring value on my above url bcoz on the basis of querystring i need to get some records also but querystring is null.
How to solve my problem plz plz help me to come out of this problem.
my url is (http://www.peopleforever.org/profiles.aspx?uid=9) should be http://www.peopleforever.org/profiles.aspx/PrakashShrestha and i have to check querysting value also in profiles.aspx page.
how is it possible to keep querystring value after urlrewritting.