IIS 6 content expiry and image cashing - asp.net

I have new a favicon in production but this does not seems to be changing even after the IIS is restarted or using content expiry immediate.
Even after i do multiple refresh it is not seems to be loading.
Or is there any other way to refresh this data?
using meta keywords or HttpCacheability.NoCache can not be done as i belive these has to be added to the .net code or aspx and will not affect actual image cashing.
Could you please suggest?

Related

Edits in .asp net website wont show

i've got an issue with website made in asp.net. A site is published and online, i've made some modifications, republished site on my computer and just uploaded a .aspx file into the server via ftp.
First time it seems to have worked after a while. But i've made a small error and want to edit it again, i did the same, but it wont change. Could it be that i need to wait some time before changes are seen? Or could it be that there needs to be a server restart or something?
If you've edited something in the aspx.cs page you will need to upload the bin directory to the remote site, or better still republish the whole site.
If it is a change to the .aspx, css or javasctipt file, the original will most likely be cached in your browser. Try a differrent browser brand or refreshing the page, ctrl-f5 does a complete refresh.
If this error was by any chance a CSS mistake, that can be easily fixed by adding a "?" at the end of the address since CSS files are normally stored in the cache of the browser and the ? tells the browser to update them. Same thing is true about JavaScripts which are kept in individual files
I'd recommend you to use the Visual Studio Publish Website under the Build instead of manually uploading the site over FTP. That built in publisher provides you many advantages of which one of them is the same issue you have faced. When you make a small change, fixing the error in host would be very faster by republishing the site that way rather than manually upping it over FTP.

Do we need to recompile .asp files?

I made some changes to the existing asp page. When I access it I don't see the changes yet and I still see the old content. Do I need to recompile .asp files?
The pages are likely cached in your browser. There are a number of ways to get around this. You can:
force a page refresh on the browser ([Ctrl]+[F5])
Recycle the application pool (if this is an application)
(or the dirty way) make a tiny change (like adding a space) to the global.asa which will in turn recycle the app pool
Edit (2017)
If you're debugging using IE then you can also set your cache to refresh every time you visit the page:
Bring up the internet options. Click the Settings button on the Browsing history section of the dialog and change the Check for newer versions of the stored pages: setting to Every time I visit the webpage...
ASP pages are scripting , you do not need to compile , just check if you have page cached on the browser .

ASP.NET 2.0 website white screen of death

I am encountering a strange issue which is only affecting several users from an over 7000 user-base. Having searched the web for several hours to no avail, I'm hoping someone here can help!
I have an ASP.NET 2.0 website and when certain users try to access the home page (Default.aspx) they receive a white screen with no content loaded. This issue is occurring both in production environment and if I run the solution against a copy of production data. So I am able to replicate the exact same issue when I pseudo the problematic users.
When debugging the application in VS2005 and set a breakpoint in the code behind in the Default.aspx, the breakpoints are fired/hit so I know the request is working. The problem seems to be once the server has finished serving the request, the response back to the client/browser is empty.
Here's another strange thing I've noticed. If I alter the HTML in Default.aspx by adding a new white line or whitespace, the page will load fine for the same set of users. I thought I had resolved the issue with this fix but unfortunately the white screen issue just manifests itself once again.
Within Default.aspx, there's some AJAX requests using jQuery .load function but this can't be the issue because this functionality exists for every user of the site. The only variable is the amount of content returned within this request can vary depending on the user. But why would it resolve itself when I put a whitespace or whiteline in the page and then manifest itself hours later?
Another thing to note is it's only Default.aspx that is encountering this issue. If I browse to another page by typing in a page in the address bar, the page is served OK.
Hope someone can point me in the right direction on how I can debug or even resolve the issue.
It sounds like your ajax is the cause but without seeing some code, it's difficult to know why.
It could be a timeout, or an error that is preventing the ajax from completing it's function.
You need to use a tool like Charles or Fiddler to debug what is happening whilst the page loads whilst logged in as these users. In a nutshell, a tool like Charles will display all the detail surrounding requests made and responses served to the browser, including any failed responses.
I think it has to do with http headers, caching or encoding. But I cannot tell more without code.
Is output caching enabled for this page?
Can you give us the raw http headers for both the request and response?
If a white screen appears, will it be fixed by pressing ctrl+f5?

IIS ASP.NET css/js files not updating until forced page refresh

When we do releases in IIS 7, we deploy new code to the releases directory on the server and then repoint the website in IIS to the new code directory. For example:
Change website directory from C:\company\releases\code-5-17-12 to C:\company\releases\code-5-26-12.
This strategy lets us revert back to a previous release in a worst-case scenario. However, the issue I'm having is that when a user who has been on the site goes to a page, sometimes they might need to explicitly refresh a page in order to get the new updated code.
Is this a caching problem? Is there a way to expire this somehow so users of the site will not be loading up old code from the previous release?
This is a specific problem with javascript files and css files.
The problem with that solution is that your users will always be downloading new css's and js's because <%=DateTime.Now.Ticks%> will be different in every refresh.
A better solution would be to concatenate the version of the application or even the last modified date of the file itself.
I got this to work:
I added a ?v=<%=DateTime.Now.Ticks%> to the end of each css and js filename and this solved it.

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

Resources