C# - Caching With Sliding Expiration In .NET Page Methods?

Mar 5, 2011

I know that when declaring a page method in ASP.NET, I can specify a CacheDuration like so:

[WebMethod(CacheDuration=60)]
public static void Foo()
{

But from what I understand, CacheDuration only supports absolute expiration. I want to have sliding expiration. So that leads me to believe that I need to access the System.Web.Caching.Cache object somehow. But, since page methods are static, and this is essentially a standalone web service, I'm not sure how to access it statically. The only ways I have seen on Google rely on getting it from the HttpContext. But, there is no HttpContext available to me here, right?Or, do I need to use the System.Runtime.Caching.MemoryCache to do my own caching?

View 1 Replies


Similar Messages:

Sliding Expiration In Web App Using Claims From STS

Jun 8, 2010

1) How/where do I set the lifetime of the session cookie in my web application when using an STS to get claims? From what I can tell, it seems I can only do this programmatically in the erviceConfigurationCreated event.

2) How/where can I make sure that the expiration is sliding?

View 1 Replies

State Management :: Authentication Cookie Expiration Not Sliding Properly?

Mar 28, 2011

we have a web based application that let users register, activate their account and then login to use the app...

it is very important that accounts must not be used simultaneously, so if user a is logged in using mynameisA/mypassword, no one else can login at the same time using the same credentials, until he logout.

this was achieved by using a cache mechanism that inserts an entry specific to that user and will keep on refreshing at each request, until the user logouts, where we remove that cache entry. on login, we check whether that cache entry is there in order to allow him in or throw a message saying that the user is already logged in... we use enterprise library 5.0 which we found more reliable than the asp.net cache, and for various other practical reasons.

now, this works fine, but the problem is that it seems like the authentication ticket and cookie doesnt slide properly at each request. so sometimes, users end up logged out because their authentication ticket got expired, and they cannot login again because the cache entry is still there.

here is the code in the sign-in page:

' if user credentials are valid, and other checks and validations...

[Code]....

here is the code that runs on every authenticated request (httpmodule):

[Code]....

and here is the web.config stuff:

[Code]....

we've done all kind of tests including metabase IIS6 monitoring. there is no apppool recycle happening...

checking the authentication cookie in firefox view cookies option shows that on each request, the expiration time of the authentication cookie is not sliding.

View 7 Replies

State Management :: Partial Page Caching (user Control Caching) And Button Events?

Jun 14, 2010

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 Replies

MVC :: Sliding Pager - Get Any Other Page Instead Of Current Page

Feb 15, 2010

i have a problem in Sliding pager. the problem is that when i tried to get any other page instted of current page it give me error The resource cannot be found. my rutting method on globa.asa

routes.MapRoute(null,"",new { controller = "Products", action = "List", page = 1 });
routes.MapRoute(null,"Page{page}",new { controller = "Products", action = "List" },new { page = @"d+" });

and my htmlhelper is

public static string PageLinks(this HtmlHelper html, int currentPage,int totalPages, Func<int, string> pageUrl)
{
StringBuilder result = new StringBuilder();
for (int i = 1; i <= totalPages; i++)
{
TagBuilder tag = new TagBuilder("a"); // Construct an <a> tag
tag.MergeAttribute("href",pageUrl(i));
tag.InnerHtml = i.ToString();
if (i == currentPage)
tag.AddCssClass("selected");
result.AppendLine(tag.ToString());
}
return result.ToString();
}

View 4 Replies

.net - Page Expiration After Postback?

Mar 11, 2010

I've been doing web development for a while and have yet to read a good answer to this question: iven a page that executes transactions through a postback, how do you prevent the user from duplicating the transaction when they do something as simple as hit the back button? I've explored trying expire the cache but I must admit I'm lacking in my understanding of ASP.NET caching. What is the approach I should use to make the old request stale and invalid?

View 2 Replies

Security :: How To Redirect The User Automatically To Login Page After Session Expiration

Mar 10, 2010

How i redirect the page to Login page automatically if session Expires .

View 7 Replies

Can Create "Sliding Page" Effect In Web Application

May 31, 2010

Looking to implement a solution on a web application but don't know if it is possible. If clicked the menu would take you to the full page with slide(Left to right / right to left). slide looks like iPhone Application.

View 2 Replies

Best Way To Initiate The Page Caching On The Server Side And Serve The Cached Page Upon?

Apr 19, 2010

I'm implementing Outputcache in my application and it works fine, but the first time always take a lot to load and the next following request will be faster...

I would like to know if there is a way to initiate the page caching on the server side and serve the cached page upon the very first request, rather than have it triggered by the user one first time.

View 1 Replies

Passing Data From Page To Page Using System.Web.Caching.Cache?

Apr 23, 2010

I'd like to pass data from one asp.net page to another. I've seen that using System.Web.Caching.Cache is a good way to accomplish this. I'm wondering if it's a good way to do it and also is there any cleanup or other things I need to keep in mind when you the Cache?

I'm not passing very much, at most two integers.

View 2 Replies

Caching - Call A Page (ashx Handler) From A Different Page?

Jul 12, 2010

I have a admin page in asp.net that adds data to a database. This database is available as a JSON string to external websites, however, since it's a lot of data, the external websites cache this data locally.I want to be able to ping the external websites to let them know the data has changed so they can referesh their cache. I figure I can setup an ASHX handler that receives a parameter telling them what data has changed, so they can both delete that data and refresh it.The only part I'm not sure about is the best way to call this external page from my admin page. Do I just do a regular WebRequest and discard the result? or is there a simpler way to call a page from code when you don't need the response?

View 2 Replies

WCF / ASMX :: Implement Caching Using System.Web.Caching?

May 15, 2010

how to implement caching in wcf service using System.Web.Caching

View 2 Replies

MVC :: Is The Page Caching?

Aug 20, 2010

I am just trying to understand the basics flow to the MVC framework by putting in some breakpoints in the beginning of the actions of a couple of controllers.

One break point is at the HomeController/Index action where it just returns View() of the "Welcome to MVC". The Second break point is at a SecondController/Index action where it uses the Entity Framework and returns a View() of a list from the db.

When I run this in debug, it breaks at the points I expected when I go from Home page to the Second page controller and back to Home. However, when I go to the Second page again, it doesn't break at all? Is the results of the Second page being cached and how and where? How do you trigger for it to get check if data is old?

I check to see if the persistence is done on the db, by changing the value of a field on the db side and it still did not cause it to break on that action and displays old information in the view. I am concerned because it is displaying incorrect values on the UI. I do not have the OutputCache attribute above this action or specified any cache on my web.config.

View 2 Replies

AJAX :: How To Call Page Methods From A Master Page

Oct 15, 2010

I have written web methods in code behind and I'm able to call them using PageMethods.(method name) in an ordinary aspx page.

If I'm trying to call the webmethods in a master page using PageMethods.(method name), it is throwing a jscript error pagemethods is undefined.

My code is like this:

[Code]....

[Code]....

View 10 Replies

Calling Page Methods Of UserControl / Page Using MSAJax?

Apr 9, 2010

Is it possible to call usercontrol methods/events using MSAJAX. I wanted to update my usercontrol by calling one of its events when a property from its parent page changes.

View 2 Replies

Using Extension Methods In Static Methods On Extended Classes?

Aug 16, 2010

I have an extension method as follows:

public static class PageExtensions
{
public static int GetUserId(this Page targetPage)
{
var user = Membership.GetUser(targetPage.User.Identity.Name);
return (int)user.ProviderUserKey;
}
}

Now in a page I need to use this method in a static WebMethod, so I have added another 'extension method' to PageExtensions:

public static int GetUserId()
{
return (int)Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;
}

and I call it as follows in my WebMethod: PageExtensions.GetUserId()

View 1 Replies

Web Forms :: How To Change This Methods In To Use Dictionary Or Extension Methods

Jul 23, 2010

public class CacheHelper { /// <summary> /// Removes object with the specified key. /// </summary> /// <param name="key">The key.</param> [code]....

I have this methods for caching..I need to change this methods to use in aDictionary<string,object>

How do I need to change this code Because I am new to asp.net I am still learning..

View 12 Replies

Use Jquery For Sliding Effect?

May 21, 2010

I am new to javascript and jquery. I have written some javascript code for some client validation.

document.getElementById(spnError).style.display = 'block';

This is how I am showing a span if there is some validation issues in the form. I want to use Jquery to show this span. I would like to slide it down slowly.

View 2 Replies

AJAX :: Sliding Images In And Out?

Dec 28, 2010

I have been exploring for a few days AJAX Toolkit and I am just wondering, if it is possible to move images in and out e.g. from right to left from asp.net image control. I would like to create a control that behaves in a similar way to the ones appearing on MS Store websites which you see there:

[URL]

I have tried to create it using AJAX SlideShowExtender but to be honest I am new to this technology and managed to make it only fade in and out. I was thinking also about using Collapsible Panel Extender but obviously I am not sure where to start.

View 2 Replies

Sliding Panel In A Table?

Aug 12, 2010

I want to display in my web page couple of show times and the list of movies under it.The display would be like this -

Show Time 6.30 PM

Movie 1
Movie 2
Movie 3

Show Time 9.30 PM

Movie 1
Movie 2
Movie 3

I want to display it in such a way that when I Click on "Show Time 6.30 PM" it would display the movies under that show and wont display anything under "Show Time 9.30 PM". Now when I click on "Show Time 9.30 PM", all the contents inside "Show Time 6.30 PM" should shrink and the list of movies should be available in "Show Time 9.30 PM".I need some idea on how to do this, will it be achieved using a sliding panel, or is there any other control.Note - For the show times and movie details I have a collection which I am binding it to a repaeter control.

What I am looking is for a SINGLE sliding panel which floats around every row in the table, So if Row 1 is clicked the panel displays the show times under it, when Row 2 is clicked, the data inside row 1 Is shrinked and the panel floats to down displaying the movies under Row 2.

View 2 Replies

.NET Page Caching In A Web Farm

Mar 11, 2010

We have a small web farm(2 servers) balanced by the built in network load balancer in Windows 2003. We have a few pages that use page caching. My question is: Is it possible that that a given user could cause a page to be cached and another user see that content? Here is the page directive for the page in question:

<%@ OutputCache Duration="1" NoStore="true" VaryByParam="none" %>

The reason the duration is set to "1" is to ensure that the page isn't cached any longer than 1 second because of transactions that actions on the page can trigger.

View 2 Replies

VS 2008 How To Do Auto Site Sliding

Sep 27, 2010

I use my web app on the wall as a dashboard type scenario. One thing that would look great would be to automatically move between pages on my site (and maybe others) after a certain time. For example, you setup page x for 2 mins, then page y for 2 mins then page z for 4 mins. Now, I can do this easily inside my existing website. However, I would like to be able to switch to other sites with login where required. So basically a website of its own that just diverts according to a script. Has anyone seen anything like this on the market or have concepts similar?

Note, my webspages are ajax-ified so any timers would not be allowed to interupt updated.

View 5 Replies

Is NHibernate SysCache Absolute Or Sliding

Feb 7, 2011

I think the question says it all, but I'd like to know for sure.

View 1 Replies

AJAX :: Use Form Sliding In Masterpage?

Sep 14, 2010

How to use form Sliding in masterpage?

View 1 Replies

MVC :: Implement A Sliding Pager In Helper?

Feb 6, 2010

How can I implement a sliding pager in asp.net mvc helper? Take Google pager for example.I've managed to create a pager like this: <previous> current: 9 of 50 pages <next> but I need something like:current: 9 of 50 pages <previous> 4 5 6 7 8 9 10 11 12 13 14 <next>

View 4 Replies







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