URL Friendly

Probably, in one of your website or API project you wish to changes that the URI From:
http://localhost/login.aspx
http://localhost/API/auth.aspx

to something that more readable

http://localhost/Login
http://localhost/API/auth.do or http://localhost/auth.api

URL Routing is build in the MVC, how about the Web Form, it’s quit easier 3 step to make it work.
Open the Global.asax

protected void Application_Start(object sender, EventArgs e)
{
//TODO: 1 Need to Register the Route
RegisterRoutes(RouteTable.Routes);
}

private void RegisterRoutes(RouteCollection routes)
{
//TODO: 2 Need to MapPageRoute
routes.MapPageRoute(“Login”,
“Login.api”,
“~/login.aspx”);

//TODO: 3 Need to bind the .api in the handler
}

Open the Web.config and register the new handler

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s