MVC 2 Disable Cache For Browser Back Button In Partial Views?

May 15, 2010

I am using Html.RenderAction<CartController>(c => c.Show()); on my master Page to display the cart for all pages. The problem is when I add an item to the cart and then hit the browser back button. It shows the old cart (from Cache) until I hit the refresh button or navigate to another page.

I've tried this and it works perfectly but it disables the Cache globally for the whole page an for all pages in my site (since this Action method is used on the master page). I need to enable cache for several other partial views (action methods) for performance reasons.

I wouldn't like to use client side script with AJAX to refresh the cart (and login view) on page load - but that's the only solution I can think of right now.

View 1 Replies


Similar Messages:

Web Forms :: Browser's Back Button And Cache?

Jan 11, 2010

Not sure if i'm posting in the right forum, if not, please move it...i have the following issue... I want to "disable" browser's back button. Seems it's not possible, but using cache.setcacheability and timing it, kinda disables the option of navigating back. I need this because in some pages of my webpage, i keep values in a Session variable so when a page loads, i need to check that variable, and, if navigating back, cant do that. I also "set cache to false" because if someone closes session, and i allow cache, someone else could handtype a url in that same pc and see the page without login (though if he/she tries to navigate through it will be kicked out because when loading a new page, i'll know that he/she is not logged) but i dont want to allow even that,

that's why cache is disabled. The problem is that loading over and over again my masterpage (header, footer, menu and stuff) is going to slow down the webpage, because every time there's a request, the page has to be sent again completely. So, is there something like a "mix" mode where i can allow cache just for a few things? If not, what's the best practice to achieve both things i'm trying: speed and security?

View 4 Replies

Web Forms :: How To Clear Cache In Browser Back Button

May 7, 2015

I am inserting and updating the image from html file upload to my gridview / insertion goes fine , but when i update the image by clicking on edit using onselectedindexchanged event of gridview, I fetch the image then change it with other image, with this simultaneously i rebind the gridview, in the beck-end everything goes fine it updates and replaces the image but in gridview it won't show after updated. I am using postbacktrigger on my submit button, but gridview won't refreshes, until and unless i click on address bar and press ENTER , or until i won't press CTRL+F5 to clear the browser cache.

View 1 Replies

Disable Browser Back Button Using C#.net?

Dec 9, 2010

Possible Duplicate: Disabling Back button on the browser i want to disable browser back button without using javascript function forward().because it remain on this page.

I want to totally disable browser back button like banking sites

send me code for that i need it

View 1 Replies

How To Disable Back Button Browser History

Mar 26, 2010

I'm using 2 masterpages in my project.One master page is for login page and another one for the HomePage where user will go thro the options to reach other pages from home page..The thing is,i have "Logout" button in my home page.When i click on the logout button,the page will be redirected to "LoginPage.aspx". After redirecting to login page,when i click on browser back button,the previous page is displaying but it should not display to user since i'm doing sensitive transactions in all pages...

I tried using following code

Code:
Response.Expires = 0;
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

but it's not working...

View 8 Replies

Security :: How To Disable Back Button Of Browser

Sep 17, 2010

i want to know how can i restrict any user to access any webpage after logging out

View 4 Replies

Web Forms :: How To Disable Browser Back Button

Jan 16, 2012

After user has logged out i am redirecting user to home.aspx and from here i do not want user to be able to go back using browser back button.. How can i do it? I used this code in javascript :

<script type="text/javascript">    javascript:window.history.forward(1);</script>

This does not work for me. In all pages i am using Master Pages..

View 1 Replies

Web Forms :: Disable Browser Back Button

Apr 16, 2012

I use following code to disable browser back button but it not work

<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>

How can i disable it.

View 1 Replies

Web Forms :: Disable Browser Back Button In IE 10 And IE 11

Feb 4, 2014

My problem is when I logout from my website, the logout button redirects to login page , and then if I click BACK button in browser, I can go back to my website. I do not want that.

What I am actually trying to make is like at mail.yahoo.com or at mail.google.com after sucessful logout user cannot view the account.

I would like to make the same functionality for my application.

View 1 Replies

Security :: Disable Browser Back Button After Logout

Aug 18, 2010

how to avoid viewing the last page visited by the user after logging out.

View 2 Replies

Security :: How To Disable Back Button Browser History In .net

Apr 7, 2010

I'm using 2 masterpages in my project.One master page is for login page and another one for the HomePage where user will go thro the options to reach other pages from home page..The thing is,i have "Logout" button in my home page.When i click on the logout button,the page will be redirected to "LoginPage.aspx". After redirecting to login page,when i click on browser back button,the previous page is displaying but it should not display to user since i'm doing sensitive transactions in all pages...

or is there any way to do with authentication and roles?

View 5 Replies

Web Forms :: Disable Back Button Of A Browser Using JavaScript

Oct 11, 2012

How to disable the back button of a browser using Javascript.

View 1 Replies

Web Forms :: Disable Or Forcing Browser Back Button Does Not Work?

Mar 17, 2011

disable working browser back button in code behind in c# or java script.

View 2 Replies

Web Forms :: Disable Browser Back And Forward Button From Code Behind?

May 6, 2014

I am doing online quiz in a Page in my website. How i will restrict users from going backward or forward using Broowser backward or forward button in that page using ASP.Net,C#,JavaScript.

View 1 Replies

C# - .NET MVC Partial Views And Routing - Using Ajax Calls To Trigger A New Request But Non Of The Partial Views Are Refreshed

Mar 9, 2010

I have an MVC view that contains a number of partial views. These partial views are populated using partial requests so the controller for the view itself doesn't pass any data to them. Is it possible to reload the data in one of those partial views if an action was triggered in another? For example, one partial view has a jqGrid and I want to refresh the data in another partial view when a user selects a new row in this grid. Is there a code example for this scenario (in C#) that I can look at to see what am I doing wrong? I am using ajax calls to trigger a new request but non of the partial views are refreshed so I am not sure if the issue is with the routing, the controller,

View 1 Replies

Web Forms :: How To Disable Browser Back Button In Index Page Or Login Page

Sep 25, 2012

am creating a web application in using c# with asp.net.

in that am using login page only as normal aspx page. other pages are using masterpage.

when i click logout button in masterpage. page will redirect to login page. after that if i click browser back button it was moving to previous page. how can i prevent this.

am using this following code in master page aspx page. And My log out button code is below.

<%if (!Page.User.Identity.IsAuthenticated)
{ %>
<script type = "text/javascript" >
function preventBack() { window.history.forward(); }
setTimeout("preventBack()", 0);
window.onunload = function() { null };
</script>
<%} %>

But exactly what i need is once if login page loaded or logged out then it wont go to previous page.

View 1 Replies

Javascript - Disable Browser "back" Button?

Aug 31, 2010

Possible Duplicate: Disable browser's back button How can I disable a browsers back button, in an asp.net mvc project. Can I use java script for this ? or is there any other ways to do this ?

View 5 Replies

MVC :: Create View With Partial Views But Submit Button Doesn't Work

Jan 11, 2011

i created a "create" view for creating a new record of my used model. The View includes partial views with the editor-fields. But the "Create" submit button doesn't work. When i copy the editor-fields to the create view without using partial views the submit button works. Here is my code: Create.cshtml

[Code]....

View 5 Replies

Security :: Sign Out Link / Click The Back Button On Browser, Still Go Back Into The Site?

Jun 24, 2010

I've created a Sign Out link on my page, just like the one you see on the top right hand corner of this forum.

This is the code i use :

<asp:HyperLink NavigateUrl="~/Login.aspx" ID="hypSignOut" runat="server" Text="Sign Out"></asp:HyperLink>

However, after signing out, I click the back button on my browser, I can still go back into the site. How do I prevent this?

View 3 Replies

Web Forms :: Prevent Back From Browser Back Button After Logout

Jul 25, 2013

When I click Logout page redirect to Login page but when click to browser arrow back then it will goes back, I want to after Logout cannot going to back page...

View 1 Replies

Disable Back Option In Google Chrome Browser?

Feb 23, 2010

In web application i.e .aspx page once user clicks on logout it redirects to login page by clearing all the sessions. Now when user clicks on back button in the browser it redirects to last view page. Since user logged out from the application how can we show the last viewd page? when user clicks on the page it checks hte session exsits or not then redirects to login page..

But i dont wna t the user to lick on the back button.. i want to siable the back option int browser .. I have achived this by

using.
<script>
window.history.forward(1);
</script>

This solution works in all the browser but Not In Google Crome..

View 3 Replies

Partial Views / How To Implement Partial Views

Jun 16, 2010

i want to implement partial views in asp.net

View 1 Replies

Web Forms :: Disable Back Button In IE

Jun 16, 2010

I am currently doing asp.net page, I want disable back & forward button all the times the page opening/loading.

View 4 Replies

Web Forms :: How To Disable The Back Button

Jul 8, 2010

My customer has a website that is unsuitable for children. Anyone under 18 is not allowed ont he site. No, it's not a porn site, it's prison related. A certain page requires the user to enter their birthdate. If they are under 18, they're redirected to another site.

He has another site written for kids who have been impacted by crime. He wants the kids redirected here, to a page that explains why they were redirected. He asked me to disable the back button at this point to keep the kids from easily going back to the original site.

I've read all the reasons why you shouldn't desable the back button, but frankly, I think this would an appropriate place to do it. I also know you really can't disable it, but I've found a number of work arounds - none of which I've gotten to work.

Is there a work around that will work?

I've thought of setting a session variable or a hidden field or an invisible label on the page that redirects the kids just before the redirect and checking the value at page load, but the code to do the checking doesn't get run unless the user hits the back button then refreshes the page. Is there a way to get code to run as soon as the back button is pressed?

View 13 Replies

Web Forms :: Disable Back Button - Use On Explorer

Mar 14, 2010

I have a shopping basket on my site, and when the customer gets to the final page I don't won't them to be able to go back i.e. use the back button on the explorer. I have seen it before on other web sites, it's like when you leave the page it 'times out'I am just not sure how that works.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved