Reputation: 1440
Global.asax Code
protected void Application_BeginRequest(object sender, EventArgs e)
{
string fullOrigionalpath = Request.Url.ToString();
if (fullOrigionalpath.Contains("/Form/Electronic/Led"))
{
Context.RewritePath("/Form/Handler.aspx?Id=Led&cat=Electronic");
}
}
How to make url map ?
Url: /Form/Car/Mercedes
Map: /Form/Handler.aspx?Id=Mercedes&cat=Car
Url: /Form/Animals/Cat
Map: /Form/Handler.aspx?Id=Cat&cat=Animals
Upvotes: 0
Views: 162
Reputation: 113242
string fullOriginalPath = Request.Url.AbsolutePath;
if(fullOriginalPath.StartsWith("/Form/"))
{
string[] parts = fullOriginalPath.Substring(6).Split('/');
if(parts.Length == 2)
Context.RewritePath("/Form/Handler.aspx?Id=" + parts[0] + "&cat=" + parts[1]);
}
Upvotes: 1