Client Not loading Fresh content in IIS 7.5 - asp.net

We have asp.net 4.0 web site hosted on IIS 7.5 on Windows Server 2008 R2 machine. The problem is that client is getting old content but server have updated copies. Client needs to press Ctrl+F5 every time to get the latest contents. Even in the case of data update on grids, client still get old data shown in IFRAME.
What could be the reasons?? Any Idea?? Is this a problem of Cache??
Any kind of assistance will be appreciated..

Page output caching stores a response of a dynamic page, such as an ASP page or an ASP.NET page, in memory after a browser requests it. When subsequent requests arrive for the page, the server sends the cached response instead of re-processing the page.
Check this article, it may be helpful for you.
http://www.iis.net/ConfigReference/system.webServer/caching
These links will also help you
http://learn.iis.net/page.aspx/710/configure-iis-7-output-caching/
https://serverfault.com/questions/126914/output-caching-with-iis7-how-to-for-an-dynamic-aspx-page
IIS7: set "no-cache" for all aspx pages but not images/css/js
https://superuser.com/questions/63014/how-do-i-turn-off-caching-in-iis7

In my case I'm using Chrome Developer Tool viewing source code of Html file hosted on IIS, when I modify the html file and refresh IIS site, the source code show in chrome wasn't modified after refresh the browser.
In the beginning I guess it's IIS caching, but after I try the link in other answer, it didn't really work: https://superuser.com/questions/63014/how-do-i-turn-off-caching-in-iis7
Finally I go to Chrome Setting and clear the Chrome File Cache, the html source code successfully changed. So in my case it is caused by Chrome's Cache, hope it help someone.

Here is what I found, there is an HTTPCompression setting that may have sendCacheHeading set to true.
I found this in the applicationHost.config file and changed it there but it can be changed in IIS also by using the Configuration Editor.
Example:
If you want to change this through IIS select Configuration Editor then click the dropdown arrow at the top and expand system.webserver then select httpCompression.
Per Laurenz request I have copied the text version of what I found in the config file and what I changed it to:
Original:<httpCompression sendCacheHeaders="true" directory="C:\Windows\IIS Temporary Compressed Files" maxDiskSpaceUsage="1000000" noCompressionForProxies="false" noCompressionForRange="true">
Changed to:<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">

Related

ASP.NET page formatting does not works

I have deployed an ASP.NET website on IIS 7. I was able to access my site using the URL http://**local host**/sitename.aspx and all the formatting of my pages is looking good.
But when I access the same page by using the URL http://**servername**/sitename.aspx from another system or on the same server where I have been deployed, the page formatting is not working properly.
What would be the best solution for this? Thanks
First a fall to check your Js/Css file path where you have not mention static file path with localhost name.
For more detail go to browser and browse your url and press F+12 so development tool will be open and check there for broken url.
I am not sure why you are worrying about formatting soo much. I mean formatting should not affect you much unless you use <pre> in your html.
There are ways to modify the HTTP Response Using Filters. Can you please makesure none of these filters present in your application for release mode.
Generally i use HTTP compression feature of IIS to compress my content, but in browser it looks correct to me.

windows web server 2008 IIS7 keeps rediricting

In IIS7 I right click on the site and choose "Switch to content view" then add a text file called test.txt right click again and switch to features view. Double click the http redirect icon and see it's not forwarding.
Right click the site and switch to content view again now right click on test.txt and choose browse only to be forwarded to some other site that gives me 404 for not having /test.txt.
I don't know where to look anymore as the settings mentioned above would indicate there would be no forwarding but opening the file proves that it does.
When using forcecors plugin for firefox and making a ajax request to the text file I can see the response header: Location http://some_other_site/test.txt.
Hope it's something simple.
[update]
In the application I checked out the settings under "Url rewrite" and found a rule that redirects. Removed this rule and stopped started IIS but it's still forwarding. Could not find anything under System32\inetsvr\config that would indicate redirecting.
After removing the url rewrite rule and testing in the browser it kept on forwarding because I think my browser remembered it was moved. Cache settings on IIS should check if file has changed after it was last cached (I think last modified headers) but somehow a redirect works differently. Did not clear my browser cache and even doing that could still cause a problem with proxies caching it.
What I did was opening it this way:
http://develop.mysite.com/test.txt?refresh=newValue
Like magic I wasn't redirected and it works now. Start FF with another profile and see if that solves the problem as the new profile should not be aware of the sites response being "permanently moved" by a previous request.

Website needs force refresh after deploy

After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and some AJAX parts are not working.
How should I proceed to serve the users with the latest version of the page after deploy?
The webpage is an ASP.Net webpage using IIS7+.
You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:
styles.css?id=1
with the id changing each time.
This will force the browser to download the new version as it cannot find it in its cache.
For ASP.NET you can use the cache control and expires headers. You can also set up similar headers in IIS 7 for your images. If you have any other cookies you can expire them manually.
I have not tried it, but it looks like you can do an ever better job of bulk setting cache control in IIS 7. See this thread and this link. At that point you are only left with unsetting any custom cookies you have (which you won't be able to control with HTTP cache control settings).
I don't know of any method to "unset everything all at once" easily.
You could use http headers to control the cache of your clients.
I'll just leave this here for you. http://support.microsoft.com/kb/234067

IIS7 showing iisstart.html instead of default document

I've a Sitefinity 4.1 website running on IIS7, I am setting "Default.aspx" at the top of the default documents list, but when I access http://www.*.org/ it shows the IIS7 welcome page.
When I access http://www.*.org/default.aspx it works just fine.
I checked the defaultDocument section in the Web.config and it is set correctly, recycled the app pool, restarted the website site, nothing so far.
What am I missing?
EDIT :
It seems to be a caching problem, if I add junk query string parameters it redirects to the correct page, ex : http://www.*.org/?aaa
Hit F5 on the browser. iisstart.html often is cached in the browser.
ctrl + shift delete on your browser clear all the cache.
then close browser and try again

Changed a page from ASPX to HTM(L) but IIS points to ASPX regardless

We recently rewrote our company homepage and have come across a peculiar error. We have very few pages that need any code behind them, so we wrote the website in static HTML served out of IIS6. The few pages that need any code (Contact Us, with a contact form, for instance) are .ASPX pages.
The previous version of the website had more .ASPX pages, even if there was no code in the code-behind. One of those pages was "management.aspx", and in the new site this is, logically enough, "management.htm". We're smart enough to not just change the file extension -- we rewrote everything, it just has the name in common.
Here's the peculiar part: Even though every link in the entire website points to "management.htm", IIS6 continues to try and serve "manangement.aspx". I've reset IIS, stopped/started the Default Web Site under IIS6, deleted pages from "Temporary ASP.NET Files" and deleted out temporary GZIP files from the server as well. This isn't MVC or anything, so we have no explicit URL routing, and while I can see us having to implement static file handling in our web.config httpHandlers, I can't imaging that being a necessity.
What gives? Why is IIS6 still trying to serve the old "management.aspx" page when we're explicitly asking for "management.htm"? What can I do to fix it?
Your bindings have to be off somewhere... check top level for *, *.htm, managment.htm, etc. Then check virtual directories.
If you paste "http://yoursite/management.htm" in your browser and you get a YSOD, this is an IIS issue for sure.
Check if you still have the bin folder in the root of your site.
Do you get a 404 because it tries to load management.aspx and it's not there?
Check the Default Page on the Website/Virtual directory in Question, and if it exists remove the reference to manangement.aspx.

Resources