This topic contains brief information about ASP.NET 4. This topic doesn’t provide comprehensive information about all new features and is subject to change. So, if you seek more information about ASP.NET 4, you can choose ASPHostDirectory as alternatives. You’ll get the best service at an affordable price. Only with @ 3.99/month, you can directly get the services you want. So, what are you waiting for? Try it!!

It is a common mis-perception that URL Routing is  exclusive to MVC, with .NET 3.5 SP1 and above URL Routing can be also used with ASP.NET Web Forms. In ASP.NET 4.0 URL Routing is fully integrated and so straightforward and powerful to use it should be preferred over URL Rewriting whenever possible.

Routing allows for SEO friendly URLs such as aspnet101.com/category/routing/ to be used instead of a URL such as aspnet101.com/category.aspx?categoryid=8 .

First you will need to register the Routes in a subroutine and then add them in the Application_Start() event:

void RegisterRoutes(RouteCollection routes)

{

routes.MapRoute(

"articles-category",  //Name of the Route (can be anyuthting)

"articles/{category}", // URL with parameters

"~/category.aspx"); //Page which will handles and process the request

}

 

void Application_Start()

{

RegisterRoutes(RouteTable.Routes);

}

In the above code, the Route named articles-category will handle incoming requests for URLs which match the articles/{category} route definition. This route definition uses “articles/” as a literal string in the URL and then takes the subsequent URL text for the category parameter. For example, the URL articles/routing will direct to the page category.aspx and pass “routing” as the value for the category parameter.

The parameters from the URL are passed to the aspx page in key-value dictionary pairs which can be accessed from Page.RouteData.Values. So in the above example the category value can be read into a variable using the below code:

string category = Page.RouteData.Values[“category”] as string;

This code would typically be placed in the Page_Load() event of the page.

In addition to accessing the parameters programatically, they can also be read by the SQLDataSource control using the <asp:routeparameter> control:

<asp:sqldatasource id="ds1" runat="server"

connectionstring="<%$ ConnectionStrings:Main %>"

selectcommand="select title, text from Articles where [email protected]">

<selectparameters>

<asp:routeparameter name="category" RouteKey="cat" />

</selectparameters>

</asp:sqldatasource>

Generate URLs Using ASP.NET Routing

A major difference between Routing and URL rewriting is that Routing also allows for the generation of outgoing URLs served on the site. In the above example if we wanted to show users a URL for the ado category of articles, then we could generate a URL by using the below code:

string url = Page.GetRouteUrl("articles-category",

  new { category = "ado" });

This code uses the articles-category Route to generate a url string, this could be used on the page or passed to the Response.Redirect method to redirect to another page. Whilst the last use is valid, if the user needs to be redirected to another page using Routing it is more efficient to use the Response.RedirectToRoute method:

Response.RedirectToRoute(“articles-category”,
  new { category = “ado”});

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!