user510336
user510336

Reputation: 373

Url routing asp.net 4

I am trying to create url routing like this

http://msdn.microsoft.com/en-us/magazine/dd347546.aspx

but I am having few questions , first why he is adding lines to the web.config , I tested it and it didnt appear that they're doing something as I commented them and nothing major appeared

second I am having this line of code that is crashing var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath,typeof(Page)) as IProfileHandler;

when casted as ihttphandler it's working , but when I am casting it to iprofilehandler(which is implemeting ihttphandler) it's giving null !

Upvotes: 0

Views: 229

Answers (2)

Meligy
Meligy

Reputation: 36594

This article is quite old as it's written before ASP.NET 4.0 was released.

Routing is now a core component of ASP.NET 4.

See this one instead: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

Upvotes: 1

Matthew Abbott
Matthew Abbott

Reputation: 61589

These are really two questions here:

  1. Why he is adding lines to the web.config - Web Configuration in .NET 4.0 applications has been greatly streamlined. A lot of the configuration that was done per-application is now included in the lower level web configuration (machine wide) (read). This means you don't need to add that configuration data in, its already done for you.

  2. You're issue with BuildManager returning null. We'd need to see a little more code than that.

Upvotes: 0

Related Questions