Mvc Site Is Not Caching Content Or Script Files?
Mar 18, 2010My asp mvc site is not caching content or script files. How do I get it to cache such?
View 1 RepliesMy asp mvc site is not caching content or script files. How do I get it to cache such?
View 1 Replies<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
The above code shows an external css inclusion tag declared in Site.Master template.
My question: why did the Asp.net MVC team choose that way rather than using "~/Content/Site.css" ?
I have been working on a site recently that relies heavily on user controls.
With the site nearly complete we are now looking to improve efficiency with some caching.
I have been looking at a number of options. In some cases a simple varybyparam fits the bill. However some user controls don't suit this model for whatever reason.
This sent me down the line of PartialCaching where I vary the cache by property.
This seems to work a treat if I declare the property in my markup, ie <uc7:JustPublished ID="JustPublished1" runat="server" categoryid="101" />
however if the control sits on a page that has a number of variants and I set the property in the codebehind eg categoryid = 101 it does not vary the cache.
I am working at a site not orginally devleoped by me. The problem is that all the pages are working fine and have no problem at my local site. but the site is not showing any content at live site from database. Niether it shows an error for it. How can I find the problem?
View 7 RepliesI want to use caching technique for .js,.css and images( to avoid round trips and to improve performance of page load) .So, on IIS 7 using Http Response Header, i set Content Expriation to 7 days.Now, on browser its caching which is avoiding round trips for static content ...which is good sign.Now, i modified one of the .js file and i deployed that .js file on server and due to caching my new code is not reflecting on client machines .So i tried lot of ways and here is what i tried after deployment of new .js file After deployment of new .js file
1) I manually delete all the browser cache(cookies,urls,forms,page content etc) on internet explorer
2) used ctrl + f5 to get refresh
3) again on IIS i went back Http Response Header section and set Content Expriation to never
4) stopped the website and restarted
5) on web.config file tried this only
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
6) Also tried to set this on .aspx page
<HTML>
<HEAD>
<TITLE>---</TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
<BODY>
7) tried to set this on .aspx.cs file
<% Response.CacheControl = "no-cache" %>>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>
My target browser is IE.None of them worked,Finally i renamed my .js file to different file name and changed code to make use of that new .js file ..but no luck on this too .Because what i set intially for 7 days still my client machine remembers that.
How do i tell IIS server to refresh cached content code , when some thing got changde on .js or .cssfiles?
I'm creating a group of surveys that query Salesforce ([URL] CRM) to generate survey questions dynamically.
The survey layouts are determined by a record type that gets passed in the QueryString. The page queries Salesforce and aggregates the questions/fields it should be using. Then it creates questions and adds them to a panel.
When I open one survey, things look great, and they work as designed. But on opening a separate survey, of a different type, the questions from the first survey are still in the questions panel, as if they are cached somewhere.
To see what I mean, open "Survey 1". Then open "Survey 2" in a new tab. Now re-open "Survey 1", but this time do it in a new tab. Compare the first "Survey 1" to the second "Survey 1", and you'll see that the second "Survey 1" has the questions from "Survey 2" added into it.
Is there something - or a way that - I should be clearing variables, public variables, sessions, or page/panel caches on every page load?
I define the array where the fields/questions are aggregated like this:
ASP Code:
public partial class _Default : System.Web.UI.Page
{
private static ArrayList field_names_use = new ArrayList { };
I have an asp.net (VB 2008) portal site. This is the only public page, all other pages are individual for each user after login. The portal site (and all others of course) is multilanguage, depending on users browser settings. Could I enable caching on the portal site? I don't have a language parameter given in the URL explicit. Could I set up the cache to create different caches depending on the users language set in the browser?
View 1 Repliesi recently made a website and have uploaded it to a hosting server. After i had completed the website i noticed that i never added in any expiration onto the files/images plus that i dont know how to do this outside of IIS. As i dont have access to the IIS on the server i need a way of embeding code to set a short exportaion on the images and xml files cached. whats the best way of doing this?
View 5 RepliesI use a Masterpage (asp.net webforms) on my site and I woluld like to implement caching of some static files, like javascript, css etc.
I've tried adding the following to my page_load (in the masterpage) but when I use Fiddler the static files are still under "no-cache".
protected void Page_Load(object sender, EventArgs e)
{
// Set cache for 1 hour on all computers and servers.
// ... Proxies, browsers, and your server will cache it.
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetMaxAge(new TimeSpan(1, 0, 0));
}
What am i doing wrong here?
i have some javascripts file which i need those to be chached for my website. also can i GZIP javascript files?
View 2 Repliesi want ot clear the browser caching xml files as i am not abel to load the newly edited xml file
View 4 RepliesI have an ASP.NET master page which references a #include file as follows:
<!--#include virtual="/includes/scripts.inc"-->
I have modified the file /includes/scripts.inc but the changes do not show up in pages. What needs to be done so modifications will be reflected? I need to avoid the following: restarting the server restarting IIS modifying web.config (doesn't appear to have any effect)
pretty much anything that causes the app domain to restart Any other options? Is there a setting which affects how long IIS caches #include files?
I have gotten confused about how page caching works in ASP.NET. Suppose a user has navigated to "home.aspx" on my website and say I release a new version of that page to the server and the user subsequently navigates to that page, he will get the updated version, is that correct? Is there ever a case where I need to be concerned that the user is NOT getting the latest version of a page(or code-behind) file? The reason I am confused is that quite sometime ago, I found the following code to put in my Page_load event to prevent page caching:
[Code]....
But the more I think about it, I cannot remember the rationale behind this. Whenever I do a release and subsequently visit my site, there is a noticable delay as ASP recompiles. So now I am wondering why the above "no caching" code would be needed or when it is appropriate to use.
At some point in the last month, two web application projects that I've been working on have stopped showing updates to aspx and ascx files until IIS is restarted, or the website they belong to is reset. This seems to be very random and I can't find any reason in the web.config sections that would cause this change. What are some good places to look for a source to this issue?Current caching parts of web.config: Removing the outputCacheProfile and restarting IIS made no difference.
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ClientResourceCache" location="None" enabled="true" duration="3600" varyByParam="*" varyByContentEncoding="gzip;deflate"/>
</outputCacheProfiles>
</outputCacheSettings>
</caching>
Commening out the staticConent and restarting also made no difference
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00">
</clientCache>
</staticContent>
<caching>
<profiles>
<add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".js" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
<add extension=".css" policy="DontCache" kernelCachePolicy="DontCache" duration="00:01:00" location="Any" />
<add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
<add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />
</profiles>
</caching>
We've also tried adding .ascx and .aspx extensions with CacheUntilChange which made no difference. Other sites with these same settings aren't having the issue. Edit: Originally this state that there also was no update when the project was built, I haven't personally been able to confirm that issue but was told by another developer that was occurring.
I have a page with a number of user controls, In one of my user controls I have a button event. I turn on output cache for the user control that has the button and vary by control using the ID property of a hidden field control in the user control. whenever I turn on the output cache my button event doesn't fire.
View 2 RepliesI'm using ASPMaker to create a content site editor. It analises the database and creates automatically the pages(list, edit and add) for all DB tables. But ASPMaker is limited to customize the resources and design.
I need any easy and fast way to create this content editor in ASP.Net C#. Can someone indicate a software or any easy way to use Visual Studio 2008?
I am creating an ASP.NET site, based on a single master page which creates the header and footer of the page. On each page there is a content placeholder where I want to allow certain users to manage in order to place their own content. On the site I am replacing, they are using sharepoint designer 2007 to connect to the site and edit the pages visually; now I just want them to edit the contentplaceholders content.
My problem is I can only see the anonymous template in sharepoint designer 2007, where I of course don't have any placeholders. If I could get it to show the loggedin template that would solve my issues, but if that's not possible, is there any other existing tool out there to do this with an ASP.NET site?
My fallback plan is to use the codebehind to fetch from an SQL table; they can create the content area in a WYSIWYG editor, and then I will build a tool for them to insert it to the database, but I don't like it as it complicates the process & I figure there must be an easier way.
I've an ASP.NET application hosted inside a local area network. The application host machine has access to the internet while the local area network clients do not.
There is one requirement where I've to show a web page with rich content (images) in an IFrame from internet (public network) address.
However since internet access is not available on the client, this somehow has to be done from server and then needs to be served to client.
How can this be done?
I have an asp.net web site with 10-25k visitors a day (peaks of over 60k before holidays). Pages/visit is also high, since it's a content site. I have a few specific pages which generate about 60% of the traffic. These pages are a bit complex and are DB heavy (sql server 2008 r2 backend). I was wondering if it's worth "caching" a static version of these pages (I hear this is possible) and only re-render them when something changes (about once in 48hs). Does this sound like a good idea? Where would be the best place to implement this? (asp.net, iis, db) Update: Looks like a good option for me is outputcache with SqlDependency. I see a reference to some kind of SQL server notification for invalidating the cache, but I only see talk of SQL server 2005. Has this option been deprecated by Microsoft? Any new way to handle this?
View 2 Replieshow to implement caching in wcf service using System.Web.Caching
View 2 RepliesMy site is 100% private (only public facing page is login) I've had the need to open up a page to anon via the <location> node in the web config...and that all seems to work However the issue now appears to be that dynamic resources such as the Telerik.Web.UI.WebResource.axd and imagesjavascript changed via handlers dont load. A firebug of the situation shows that for those dynamic elements, it's trying to re-direct to login to get them Is there anyway around this?
View 3 RepliesI would like to create personal web site including search engine in my site content. I don't know algorithem how to build it yet. how to build my own search engine?
View 1 RepliesI notice that some sites are coping the content of one of my client's sites using automated agents. I want to detect their requests and show them a captcha code to prevent them from coping the site content. Is there anyway to detect them?
View 2 RepliesI am a PHP developer and have been asked to make some slight amendments to an ASP.net site. I can make these amendments but the biggest challenge seems to be getting the actual site up and running on my own server! I have a had lots of errors with regards to the paths to files, as the website is linked absolutely to the root folder and on my development server I cannot have the files at the root. I have therefore worked my way through some of the files making the paths relative so I can at least see some of the site running but then I came across this error:
CS0103: The name 'Data' does not exist in the current context
Line 5: protected void Page_Load(object sender, EventArgs args)
Line 6: {
Line 7: rptNews.DataSource = Data.NewsArticle.GetLatestNews(3);
Line 8: rptNews.DataBind();
Line 9: }
I assume this is something to do with data being called from a database. How to get the site and database up and running as I have no idea where to start and feel I am going round in circles.
I need to upload files from one site to another and I thought about using the WebClient class and FileUpload method from the System.Net namespace. I read the MSDN documentation and it seems an easy task to achieve but something is going on wrong. For now, I am only testing with the following simple code to upload a file to a test web server in our office which uses HTTP port 8080 instead of 80:
[Code]....
The code above issues the following exception: "The remote server returned an error: (404) No Found." I have made sure that both paths are correct.
Also, does the UploadFile method saves the file physically in the hard disk (I suppose so) or does it load it into the server's memory?