1

I work on a .NET web application, targeting multiple .NET and IIS versions, that is delivered with a web.config file. We've been able to use the same web.config file for most setups, but we have one line that is giving us trouble.

One of our /configuration/system.web/handlers needs to specify a path to the aspnet_isapi.dll.

<remove name="ASP.Net-ISAPI-Wildcard" /> <add name="ASP.Net-ISAPI-Wildcard" path="*" verb="*" type="" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" allowPathInfo="false" preCondition="runtimeVersionv2.0" responseBufferLimit="4194304" /> 

As you can see, the path points directly to a framework version, which causes problems since some people are 32-bit users (who use Microsoft.Net\Framework) and others are 64-bit users (who use Microsoft.Net\Framework64).

Is there an environment variable, like %windir%, that I can use to specify the path to the right framework version, without having to hard-code a path to the .NET DLLs?

1 Answer 1

3
+50

To answer your specific question, no, there's no environment variable for the asp.net isapi module.

With managed handlers this is not a problem, you just specify the type name and signature of the assembly you want, and IIS will load it from the Global Assembly Cache

For ISAPI modules however, you still need to provide a path, but what you can do is define 2 handlers and give them different preconditions based on the hosting application:

<remove name="ASP.Net-ISAPI-Wildcard" /> <add name="ASP.Net-ISAPI-Wildcard-64" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="runtimeVersionv2.0,bitness64" /> <add name="ASP.Net-ISAPI-Wildcard-32" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="runtimeVersionv2.0,bitness32" /> 

(details left out to emphasize relevant attributes)

2
  • Let me try this at work tomorrow before accepting. Thanks! Commented Dec 18, 2013 at 5:23
  • Worked for me! Have some rep. Commented Dec 18, 2013 at 16:46

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.