Why does server show old ASPX page (even if deleted)? - asp.net

When I upload a new .aspx file, the server continues showing the old version.
What I've tried:
Forced page refresh: Control+R or Control+F5
Deleted the file on the
server & refreshed page.
Expected result: new page shown (or 404 error when page deleted)
Actual result: old page dhown.
Repro steps:
View https://www.bungalowsoftware.com/subscription/info/default.aspx
The START NOW button shows a link to .../create.aspx
View in File Manager and that button shows link to /buy
RENAME$ /default.aspx to something else (default.disabled.aspx, etc.)
Browse to the site again. Should give a 404, but still shows page.
This is happening with every aspx page I've tested.
Note: if I update or add plain .html files* the new versions show up immediately through the browser.
*in the same directory as the .aspx page I'm testing.

To resolve the cache issue you could follow the below steps:
1)Open Internet Information Services (IIS) Manager.
2)In the Connections pane, go to the site for which you want to disable caching.
3)From the middle pane, double-click HTTP Response Headers.
4)In the HTTP Response Headers pane, click Set Common Headers... in the Actions pane.
5)In the Set Common HTTP Response Headers dialog box, check the box to expire Web content, select Immediately, and then click OK.
Note: After making changes to the iis site folders or pages do not forget to restart iis server or site.

Related

Drupal 7. Server sending tpl before main site html

When clicking on a specific menu button the server sends out the contents of a tpl file first before sending the primary HTML. This renders the <div... above the <html... breaking the site.
This only happens when I clear the cache and first visit to the relevant page. If I refresh the page the site works as it should. Further visits work as well. Its just the initial visit after a cache flush this happens.
Any ideas?
Found a rogue
print($menu)
Sorted

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.

Client Not loading Fresh content in IIS 7.5

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">

using Fiddler to replace HREF

I want to replace the HREF values of a website to my local server hosted images using Fiddler. Can this be done and how?
Open fiddler and switch to the AutoResponder tab. Do a hard-refresh on your site, and let all of the session files load up in the left panel. Once you see your page containing your links, make sure it's decoded (right click and hit 'decode').
Drag your file over into the AutoResponder panel (you may need to enable AutoResponders, make sure you let unmatched sessions pass-thru). Once in the AutoResponder tab, right-click your page and click "edit response." From here, you can modify the contents of this page.
From here on out, refreshing your site will load that file from the AutoResponder instead of from the server or cache.

Session variable trounced by Chrome and FF

In my asp.net web application on page load I grab the current page url and store it in a session variable to track which page the user is on so they can return to it if they enter an admin area, do some navigating around etc. They can then click the return button and will be taken to the page they were on before entering the admin.
This all works in IE8; however in FF and Chrome when in the admin the return link redirects to the custom 404 page I have for the web app.
For testing purposes I added the code I wrote below in with my page load event:
Response.Write((string)Session["navurl"]);// displays "http://somedomain.com/customerror/default.aspx"
Session["navurl"] = currentUrl;//ex. currentUrl = "http://somedomain.com/contact/"
Response.Write((string)Session["navurl"]);//ex. currentUrl = "http://somedomain.com/contact/"
Again this works without a problem in IE, but in FF and Chrome on page load the session variable displays the 404 page link and after setting it displays the correct link. I used fiddler to see what was going on and Chrome is throwing a 404 in the GET header for the favicon.ico file, which I am not using in this web app.
I added the faviocon file and the link in the head of the site.master file and Chrome and FF now work fine; I'm still not sure why this is happening. Anyone have an ideas why or how my Session variable is getting overwritten by Chrome or FF?
As a side note I have stepped thru the process debugging and currentUrl is the proper url.
Well, if you are using the .NET handler to serve all pages (ie. all file extensions), then it makes sense that when your browser will make a request for favicon.ico (google to understand what this is), the server fails to find it, and it redirects to a 404. Which in turn modifies the Session variable as "the last page served" : 404.
Now when you render you admin page, and query the Session for "the last page served" what do you get ? "404".
I'd suggest checking the URL to see if it reffers to a user-navigationable page before storing it in session
if (IsAUserPage(currentUrl)
Session["navurl"] = currentUrl;
When you access your admin, are you preserving your session? Using Fiddler have you seen another request for your page? Look for image tags with src="", or iframes.
You must set the Session var on every front end page, but, you never must never set it on the admin pages, only getting to build the "Back" link. If you are using Global.asax events, take care to avoid change the var when serving admin pages.

Resources