.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 cache MVC page with sign in info?

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net


[OutputCache (Duration=20, VaryByParam="None" )]
public ActionResult  display()

This code cache whole page.

But, my site has user infomation on top like this ASP.net. The user info "Signed as userid | Edit Profile | ..." section should be changed when user sign in/out. But rest of the page is always same and it's good to Cache.

If the above code is used, the user info on top also cached and give wrong info to user.

So, what is the best solution for this?

Any idea?

Thank you,

View Complete Post

More Related Resource Links

TypePerf, Buffer Cache Hit Ratio, Page Life expectancy and some other counters....

Hello, I 've scheduled a Task on a Windows 2008 R2 Server (a Blade with 2 Processors (6 core HT) and 18 GB RAM) to check some SQL Server 2008 Performance Counters. The task runs TypePerf that checks the Counters every 15 seconds for 10 minutes. The task is scheduled every hour. The strange result is that Buffer Cache Hit Ratio, Page Life expectancy and some other Counters are ALWAYS = 0 but if I run PerfMon, Buffer Cache Hit Ratio is 100 and  Page Life expectancy >>>> 300. Any Idea? Thank youLuca Bovo MCTS - MCITP SQL Server 2005 (Database Administrator and Database Developer)

Log Cache Page size

Hello: trying to get more details about Log Cache. i am aware that Data page size is 8KB. want to know the size of page in Log Cache, as i am not able to see that inofrmation in BOL & at MSDN. Any link or pointer is highly appreciated. Thanking in advance. Thanks

Customizing Sign In Page

I have a claims based site with the default sign in page. I would like to force my users to login using forms and not have the option for windows. I don't want to write an entire new sign in page to do this. Is there a way to disable the drop down list and force the selection to forms? Thanks.

Reg passing info from aspx page to New form.aspx page of list in sharepoint



Initially i have Newform.aspx in the list.In that when i am clicking an icon that is available in Rich Text Box Editor it is taking me to another aspx page.In that page i have custom web part with One Field Control to upload  and one Button to upload the files.Now my requirement is as soon as after uploading these file from web part i should display the file names in the Rich Text Box.Please share your ideas of capturing file names in the web part and getting those file names in the rich text box in the newform.aspx of the list please let me know

Thanks & Regards,


strange Cache and GridView bug after googlebot crawls a page


I have a strange ui bug in GridView !

GridView adds <font color="#000FFF"> after a page is accessed by a Google crawler and then when the page is views from the cache created by the bot  !!!

It is happening in the HeaderText "th" and TemplateField's and HyperLinkField's

I never set the color to <font color="#000FFF"> and i have CSS class's and ForeColor with all different colors

When a user enters a page it doesn't happens and no font tag is added !!!

please help...

Sharepoint 2010 popup page issue while sign in as diferrent user


We have a SharePoint 2010 portal in which one of the functionalities opens a list item add form as a popup. We customized this add form using SPD by adding the following java script functions.

<script type="text/javascript">



function PreSaveAction()

 var reqType= document.getElementById("ctl00_xxxxxxxxxxxxx_ctl00_Lookup").value;
 reqType= reqType.replace(/^\s+|\s+$/g, '');

 var reqDesc= document.getElementById("ctl00_xxxxxxxxxxxxx_ctl00_TextField").value;
 reqDesc= reqDesc.replace(/^\s+|\s+$/g, '');
 var error="";
   error=error+" &";
  error=error+" Description";

 error=error+ " can not be empty";



greeting to the senior programmers , 


i am a fresh person into asp.net programmings, and i have designed a signup page using stored procedures, and its executed successfully, but i have tried it by myself by reading tutorials on the internet, and now i am going to design a log in page, that need to check the username and password that i have already used in signed up page, and need to use it to check the data source. 


i think you people can understand what it is. i have attached the code and sql details 

i have created a stored procedure for sign page too here i have attached the code, do i use stored procedure to do this thing, or how do i do this thing. please help me people. please.


this is the code for the signup page 



using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;

Cache Authenticated Page



How to cache authenticated page?

Stephen Walther suggests not to cache authorize page (http://stephenwalther.com/blog/archive/2008/08/29/asp-net-mvc-tip-40-don-t-cache-pages-that-require-authentication.aspx) , but every page I have need the built-in Authorize() filter for easy integration. Sad

I have tested both Authorize() and the CacheFilter in the same controller and indeed I can see the other users role account . How can I have the Authorize() and the Cachefilter in the same controller then?

The Cachefilter can be found here (http://weblogs.asp.net/rashid/archive/2008/03/28/asp-net-mvc-action-filter-caching-and-compression.aspx).

Thank You,


What happens to a page's cache when a user logs in?


When you cache a page I assume you are saving the rendered html that gets sent to the user who requested the page. What happens when the person who requests the page is logged in and their user name is displayed at the top of the page. This I assume will change the html that is rendered and thus mean the cache is rebuilt?

If so is there any point caching pages in such a scenario as I assume there will be a performance penalty rebuilding and storing the cache all the time?

I am not sure if this makes any difference but all the pages have a master page and this is where the login is displayed.



Two "Windows Authentiaction" in the sign in page's dropdownlist




In the dropdownlist as above image, there is only one "Windows Authentiaction"(the other

one is Forms Authentication). But in one of my sharepoint web application, there are two

"Windows Authentiaction"(no Forms Authentication).

I get this trouble after trying to config FBA in that web application, but didn't success.

Other web applicatons in the farm is still OK(use windows Authentiaction to sign in


Can you give me some advice to solve the problem?

thank you for your help.

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

Like Celebrities - info about all celebrities

Like Celebrities - info about all celebrities

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.


I have 2 web pages. First page has a textbox and a button control.

when I enter test and click on the button , system goes to the second page. And in the second page I want to access the Textbox in the first page. When I try to do this I get the following error.

"Object reference not set to an instance of an object. Following is my code :

Dim txt As New TextBox

' Find the server name on the previous page
txt = CType(Page.PreviousPage.FindControl("TextBox2"), TextBox)
If Not IsNothing(txt) Then
Response.Write("[Name Not available]")
End If

I know I could do this with session, but I want to use the Page.PreviousPage.FindControl. Any help is greatly appreciated

Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Launch CMD File From ASPX Page


My organization uses a CMD file to install updated files for a major enterprise application. Currently, we send out an email to users with a link to the file and instructions to run it, BUT inevitably users don't update their machines until their in field and try to start the app.


We're now liking the idea of using an ASPX page to prompt the users to run the updates and to capture the fact that the updates have been run. I realize that we can't capture the success or failure of the update. But we'd like to capture the user accessed the page.


Is it possible to embed into the markup for the page a link to the file on the local intranet that the users can click on to run the file?

The user accessing the page would capture that they did just that. We'd deal with wether or not the update was actually installed or if it failed later with them directly.

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