.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to disable cache

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :ASP.Net
I know this question has been asked a dozen times but in all the posts I can't find an answer that works for me.   I am trying to completly disable all cache from a page, so when the user goes back using the browser buttons, there appears the typical sign of "This page has expired".    So far I've tried the page directive: <%@ OutputCache Duration="1" Location="None" %>   The Meta tags: <meta http-equiv="Expires" CONTENT="0"> <meta http-equiv="Cache-Control" CONTENT="no-cache"> <meta http-equiv="Pragma" CONTENT="no-cache">   And the code:     Response.ExpiresAbsolute = DateTime.Now     Response.Expires = -1441     Response.CacheControl = "no-cache"     Response.AddHeader("Pragma", "no-cache")     Response.AddHeader("Pragma", "no-store")     Response.AddHeader("cache-control", "no-cache")     Response.Cache.SetCacheability(HttpCacheability.NoCache)     Response.Cache.SetNoServerCaching()   But every time the back button is clicked, there appears the previost page.   How can I solve that?   Thanks  

View Complete Post

More Related Resource Links

Use Membership but bypass / disable password usage for users


I have an application that does LDAP authentication. The authentication is done on the code behind page of my Login.aspx page. Once the user passes LDAP authentication, a cookie is set and I redirect:

FormsAuthentication.RedirectFromLoginPage(UserName.Text, False)

I would like to setup membership in my application and keep track of some user information. But due to company security requirements, I cannot store user passwords on my application. That must stay on the LDAP server only.

Is there a way to store users but disable password storage on the aspnet_membership table?

AppFabric Cache: Real-World Usage and Integration


Windows Server AppFabric provides a distributed cache for both web and desktop applications. Well show you how to integrate AppFabric caching into your apps, along with some hints for taking advantage of new cache features in the .NET Framework 4.

Andrea Colaci

MSDN Magazine June 2010

Security Briefs: Active Directory Cache Dependencies


If you're not taking advantage of Active Directory, you should be. Learn the benefits from Keith Brown.

Keith Brown

MSDN Magazine July 2007

Cutting Edge: Implement Custom Cache Dependencies in ASP.NET 1.x


One of the most compelling improvements that ASP. NET brought to ASP programming was the Cache object. The Cache has some similarities to the Application object and is a container of global data (as opposed to session-specific data) that features a fair number of innovative characteristics.

Dino Esposito

MSDN Magazine July 2004

Wicked Code: Supporting Database Cache Dependencies in ASP.NET


Developers love the ASP. NET application cache. One reason they love it is that ASP. NET lets them create dependencies between items placed in the cache and files in the file system. If a file targeted by a dependency changes, ASP.

Jeff Prosise

MSDN Magazine April 2003

Disable check box in a gridview does not working



I have a check box in a template field in a gridview.

Based on some condition, I want those check boxs to  be enable and disable.

I am trying the below code but does working..

 protected void GVstudents_RowDataBound(object sender, GridViewRowEventArgs e)
              if (e.Row.RowType == DataControlRowType.DataRow)
                    string studentID = GVstudents.DataKeys[0].Value.ToString();
                    int stdID = Convert.ToInt32(studentID);
                    int schID = profile.getSchoolIDByStudentID(stdID);
                    int tchrID = profile.getTeacherIDByStudentID(stdID);

                    if (patti.chkIsTeacherPaid(stdID, schID, tchrID))
                        CheckBox cb = (CheckBox)e.Row.FindControl("chkTeacherPayment");
                        cb.Enabled = false;
                        cb.Checked = true;


any help??

Disable filtering on a Dynamic Data list view.


I have an entity set of NotificationTemplates, and each one of these has a collection of zero-many SmsTemplate entities. When editing or viewing a NotificationTemplate, I have a link to View SMS Templates. That link takes me to a List view for the SmsTemplates entity set, filtered for the NotificationTemplate I was viewing.

How can I prevent the user changing this filter to show SmsTemplates for another NotificationTemplate? That is, I want the filter, but it must be read only. The drop-down just mustn't drop down, it must just display the name of the NotificationTemplate that these SmsTemplates belong to. To view SmsTemplates for another NotificationTemplate, the user must click View SMS Templates from that other template.

This was originally asked by myself on SatckOverflow at: http://stackoverflow.com/questions/3514373/disable-filtering-on-a-dynamic-data-list-view

How to Cache System.Collection.Generic.List object


I need to cache System.Collection.Generic.List object with expiration time

var Root = from feed in feedhotel.Descendants(ota + "HotelContent")
                           where (feed.Attribute("HotelCode") != null)
                           select new xmlhotel()




return Root.ToList();

Is it possible to cache Root.ToList() for some time....

HTML Table Disable


I have a HTML Table that I use to place the control in so they display nicely on my Web Form.  I also use the Disable method to keep unwanted users from editing those controls based on their log in information, however I still want the information to be displayed for their review.

The information is displayed for example in the Text Boxes, however when they hit Enter on the form because the table is disabled for some reason the information is lost when I do my update to the SQL Server (the text box shows "")?

Why is it I can see the information on the screen, but the text box shows empty when hitting enter on the form?



Checkbox disable/enable


I hope someone can be kind enough to help/advise me with this.

I have a web form with multiple checkboxes on it , with one of the checkboxes as the main (controlling) checkbox.  By this I mean that when this main checkbox is checked then all the other checkboxes need to be disable and when its unchecked these other checkboxes need to be enable.

I've found (plenty of) code to do this in javascript but i would really prefer to to it in vb(.net), if possible.

I hope all this makes sense to you.


Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field


Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads

//This locks the fields the users should not modify
function lockFields()
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

How to clear cache


We have an ASP.NET-based print tool that will create a printable version of a webpage (as a PNG, I believe). The URL is something like:


which is displaying an older version of the webpage.

The URL to just the webpage displays the current version:


Observations so far:

  • I've deleted temporary Internet files on clients, which had no effect.
  • The behaviour is the same on different clients, which suggests a server issue.
  • I've requested that the temporary ASP.NET files are deleted from:
    C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\mysite_tools_printfromweb
    (It's a customer's web server. I've checked the version of ASP.NET associated with the tool.)

So, my questions are:

Am I right in thinking this is probably a caching issue, and are there any other locations and/or settings I should be looking at?

With thanks.

Disable VS2005 Undo?


Does anyone know if there is a way to disable the Undo feature within VS2005?  I searched through the options but nothing jumped out at me.


Disable links based on membership



I've somehow managed to successfully get Membership working on a test site I'm playing with (learning!). I've reached a point where I can redirect users to another page if they do not have the required level of membership - using the allow feature in a web.config within a folder.

What I would like to do now is create a main menu of links (a back office menu visible after the use has logged in), and disable a link if they do not have access to view that page. Is this complex? I'd be grateful for any sample code to get me started.

Many thanks

disassembly tab window how to disable


everytime i debug the application i get the disassembly tab window
 i tried tools/option & unchecked show disaasembly if not is not avaliable & sourec file to exce;ty open the original file

but still i get
after making the chnages i restarted my system but still i get it
how do i disable teh disassembly tab

Problem insert POCO to Velocity Cache



I want to put POCO object to Velocity cache. How can I serializable ICollection to Velocity cache, or exclude ICollection from serialization?

I got this exception

Type 'System.Collections.Generic.ICollection`1[Model.Collection]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend