noel58
asked on
How do I convert a URL in ASP.Net
I'm trying to use Context.RewritePath in protected void Application_BeginRequest to rewrite a URL but without much luck.
I want to be able to take the URL
http://secure.myapp.com/customer/atlascs
and convert this using a rewrite to
http://secure.myapp.com/Login.aspx?customer=atlascs
I've tried to use the code supplied but with no luck as I simply get told that my page cannot be found. Any suggestions are welcomed
I want to be able to take the URL
http://secure.myapp.com/customer/atlascs
and convert this using a rewrite to
http://secure.myapp.com/Login.aspx?customer=atlascs
I've tried to use the code supplied but with no luck as I simply get told that my page cannot be found. Any suggestions are welcomed
string fullOrigionalpath = Request.Url.ToString();
if (fullOrigionalpath.Contains("/customer/"))
{
string customer = fullOrigionalpath.Substring(fullOrigionalpath.LastIndexOf("/"));
Context.RewritePath("/Login.aspx?customer=" + customer);
}
http://msdn.microsoft.com/en-us/library/ms972974.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.