Rectangle 27 0

    <handlers accessPolicy="Read, Script">
      <remove name="StaticFile" />
      <add name="ASP.NET-ISAPI-2.0-Wildcard"
         path="*" verb="GET,HEAD,POST,DEBUG"
         preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
      <add name="StaticFile" 
         path="*" verb="*" 
         resourceType="Either" requireAccess="Read" />

I have added the given code in my web.config, after that it gives the 500 Internal server error...

Probably an error in your config, did you add it into <system.webServer>? Can you post what you have? Sorry just realised I gave you wrong link as well, I'll fix.

have a look a the error message, or post your config.

just realised in your question you refer to .net 2.0, routing is only available in 3.5 SP1 - are you using that?

.net 3.5 - URL Routing is not working in IIS 7.0 witrh apllication poo... .net-3.5 iis-7 url-routing application-pool
Rectangle 27 0

I hope I've understood your question correctly, but please do let me know if I haven't.

It sounds like the sole issue you have is that when you write the links to the response they sometimes reference the wrong root URL.

I notice that you use ~/ . This would resolve and write the entire URL to the response I think. It is better to use only / when writing links to the response.

So in your example you would write /myfolder/mypage.aspx. The browser would then resolve the / to mean that it's from the root address of the site, whichever that may be.

Thanks for commenting "The Bearded Llama" :) - Your suggestion is only a work-around. I am able to resolve my links in a similar way, but I am more interested on figuring out why IIS is doing this and how to prevent it, rather then working around it. I've add URL rewrites to help with the issue, but I sure wish I knew how to prevent it.

Well, it's not really a workaround, it's more keeping with DRY as well as not hardcoding things. Although, now I understand what your question was about. It sounds like it's an IIS setup issue. If you post your IIS setup, I'll be more than happy to have a look and try to help. - IIS app pool caches wrong url - Stack Overflow iis-7
Rectangle 27 0

I know it's a long shot, but I've had a similar problem with my IIS setup. I solved it by going to the already mentioned "bindings" window through "Edit Bindings".

Then I removed all the not wanted bindings, then adding the hostname the server should answer to.


This ensures that always resolves to the local computer.

After executing iisreset.exe as administrator my problem was over. - IIS app pool caches wrong url - Stack Overflow iis-7
Rectangle 27 0

HttpContext.Current.Request.Url is not a cacheable item. That value comes from the HOST value of the HTTP headers. Which means it is passed in to the application from the request.

The only time it should take that second URL is if the requests HOST value was

There are three possible fixes here. The first is to set your bindings and have any requests to be forwarded over to

The second, because your primary issue appears to be about SSL is to get a unified communications (UC) SSL certificate and install that on your server. This would be to cover the and domain names.

The third is to simply create a separate IIS site which points to the exact same production directory as the first one. Each site would have only 1 domain name it's responsible for. - IIS app pool caches wrong url - Stack Overflow iis-7