Step.1 create Default page.And add a control like a link button.
<asp:LinkButton ID="Linkbtn" runat="server" PostBackUrl="~/saleem">Redirect</asp:LinkButton>
You can change postback url which you want to replace page name or extension.
Step.2 Open web config file and write this in system.web tag.
<system.web>
<httpModules>
<add name="picurls" type="picurls"/>
</httpModules>
</system.web>
Step.3 Add new web page where you want redirect.
page name like hide.aspx
Step.4 Add a class file in solution explorer >>App_Code name as picurls.cs
Step.5 in picurls.cs page.
>>use these name spaces
using System.Web.Configuration;
using System.Web.Handlers;
Step.6 Inherit IHttpModule like this.
public class picurls :IHttpModule
{
public picurls()
{
}
#region
public void Dispose()
{
}
Step.7 Write a method in this class
public void hideUrl(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
if (app.Request.RawUrl.ToLower().Contains("/saleem"))
{
app.Context.RewritePath( "~/hide.aspx");
}
}
Step 8 Write a Init method
public void Init(HttpApplication contaxt)
{
contaxt.BeginRequest += new EventHandler(hideUrl);
}
Now run your Default.aspx page and click link button.
then you found that your url name is chaingeurl/saleem
when I click link button i get a server error like this
The HTTP verb POST used to access path '/WebSite23/Default' is not allowed.