url rewrite
the default url is (www.abcd.com/home.aspx) if i write (www.abcd.com/raj/home.aspx) , so it check the name (raj ) is present in data base or not if yes then url change as (www.abcd.com/raj/home.aspx) if not the it go to the default page (www.abcd.com/home.aspx)
Sandeep Singh ShekhawatPosted Jan 2, 2014, 7:24 AM
RobbinsonPosted Jan 2, 2014, 7:01 AM
As posted earlier,You can use Url Rewrite feature of the asp.net here.
All the request will trap by application begin request event of asp.net pipe line.
void Application_BeginRequest(object sender, EventArgs e) {
string fullOrigionalpath = Request.Url.ToString();
if (fullOrigionalpath.Contains("www.abcd.com/home.aspx")) {
Context.RewritePath("www.abcd.com/raj/home.aspx");
}
};
Another way is to write or use UrlRewrite module, if you are using IIS 7.5 or later version, you can install it from below location.
http://www.microsoft.com/en-in/download/details.aspx?id=7435
Now, Next step is to create Rewrite rule. Below link will explain how to create Rewrite rules.
http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
Hope, this will help you out. Feel free to connect in case of query.
Please don't forget to mark as answer if this post helps you.
Satyapriya NayakPosted Jan 2, 2014, 6:51 AM