Rectangle 27 0

asp.net IIS app pool caches wrong url?


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

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.

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.

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.

Note
Rectangle 27 0

asp.net IIS app pool caches wrong url?


%windir%\System32\drivers\etc\hosts
127.0.0.1 www.mydomain.com

After executing iisreset.exe as administrator my problem was over.

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 www.mydomain.com the server should answer to.

This ensures that www.mydomain.com always resolves to the local computer.

Note
Rectangle 27 0

asp.net IIS app pool caches wrong url?


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 masdfg.my.provider.net

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 mysite.com and masdfg.my.provider.net 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.

There are three possible fixes here. The first is to set your bindings and have any requests to masdfg.my.provider.net be forwarded over to www.mysite.com

Note