tags:

views:

101

answers:

0

I have an ASP.Net MVC application which works fine on IIS 6.0 / Windows Server 2003. When installed on IIS 7.5 / Windows Server 2008 (integrated mode), it works but when the application attempts to generate an URL, it runs into the following error:

[NullReferenceException: Object reference not set to an instance of an object.] 
System.Web.HttpServerVarsCollection.Get(String name) +10960764 
System.Web.Mvc.PathHelpers.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +345 
System.Web.Mvc.PathHelpers.GenerateClientUrl(HttpContextBase httpContext, String contentPath) +80 
System.Web.Mvc.UrlHelper.GenerateUrl(String routeName, String actionName, String controllerName, RouteValueDictionary routeValues, RouteCollection routeCollection, RequestContext requestContext, Boolean includeImplicitMvcValues) +256 
System.Web.Mvc.UrlHelper.Action(String actionName, String controllerName, RouteValueDictionary routeValues) +36 

This error is raised when I call the Action method of an UrlHelper from a custom HTML helper I have created. The custom HTML Helper receives a reference to the UrlHelper object and uses it afterwards to generate URLs using the Action method. I noticed that when I call the Action method directly from the view, this error is not raised. However I didn't get from this difference the reason why it doesn't work on IIS7 -just a possible workaround.

Do you have any idea to fix this issue ?

Thanks,