Click here to Skip to main content
16,014,734 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to send email? Pin
Shahdat Hosain13-Apr-09 18:39
Shahdat Hosain13-Apr-09 18:39 
GeneralRe: How to send email? Pin
Abhijit Jana13-Apr-09 21:06
professionalAbhijit Jana13-Apr-09 21:06 
GeneralRe: How to send email? [modified] Pin
Shahdat Hosain14-Apr-09 5:02
Shahdat Hosain14-Apr-09 5:02 
GeneralRe: How to send email? Pin
kishorgh13-Apr-09 21:12
kishorgh13-Apr-09 21:12 
Questionsubmit form inside an automatically created ASP form Pin
shabya13-Apr-09 11:29
shabya13-Apr-09 11:29 
AnswerRe: submit form inside an automatically created ASP form Pin
Christian Graus13-Apr-09 13:14
protectorChristian Graus13-Apr-09 13:14 
GeneralRe: submit form inside an automatically created ASP form Pin
shabya13-Apr-09 19:32
shabya13-Apr-09 19:32 
Question[Asp .Net Page output caching] invalidate subset of pages on demand only Pin
lermi13-Apr-09 11:27
lermi13-Apr-09 11:27 
Hello,

I am writing an engine for a forum. Now I have stumbled upon some problems with caching. I have a board view with multiple threads printed and each
one has a first few replies added. Now I decided I want to have caching not based on timeout but on custom action. When a user uploads some reply, only
then should the page expire from cache. It is also desirable to expire only those versions of pages that need to be expred (based on query string parameters).

let's say I have this situation:

so http://forum/index.aspx?page=1 cached
so http://forum/index.aspx?page=2 cached
so http://forum/index.aspx?page=3 cached
so http://forum/index.aspx?page=4 cached -> reply happes
so http://forum/index.aspx?page=5 cached
so http://forum/index.aspx?page=6 cached

.. pages 1 - 4 must expire from cache. The rest should stay in cache. Also I do not want any of the pages to expire from the cache before this action
for whatever reason this could happen. Please help me with this.

for now I have written in page load of index.aspx this:

1) in global.asax, Application_Start:
HttpRuntime.Cache.Insert("all", DateTime.Now);

2) and in my index.aspx page load event this:

Response.AddCacheItemDependency("all");
Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
Response.Cache.SetExpires(DateTime.Now.AddMinutes(5));
Response.Cache.SetValidUntilExpires(true);
//Response.Cache.VaryByParams["page"] = true;

3) then if I want to reset all pages dependend on key all, I call index.aspx with query string parameter ccreset and again
in global.asax Application_BeginRequest I check for this query string parameter and modify key all to invalidate cache like this:
HttpRuntime.Cache.Remove("all");



PROBLEMS
________


A) Even without trying to invalidate my cache, page output caching occurs only if I do not specify VaryByParams. As fast as I add this line of code:
Response.Cache.VaryByParams["page"] = true;
caching stops. I print a timestamp on the page to see this. I do not understand this. Problem is exactly the same if I use the declarative syntax inside
aspx page.

B) Let's say I forget about the VaryByParams, caching works out of the box, time stamps printed on my page confirm this. But, even when I modify the
"all" key in my cache hoping to initiate cache invalidation nothing happens. All pages remain in the cache as nothing happened. Why is that?


QUESTION
_________

I would like to understand why B) happens and also what is up with A). But please, if I should be doing this thigs some other way feel free to skip
answering me my first two questions and just explaing to me what is the easiest and most straight forward way to achieve what I want.

Thank you for your replies in advance
Andrej
QuestionOrder Page... I'm almost there Pin
Dirso13-Apr-09 8:07
Dirso13-Apr-09 8:07 
AnswerRe: Order Page... I'm almost there Pin
Yusuf13-Apr-09 8:42
Yusuf13-Apr-09 8:42 
GeneralRe: Order Page... I'm almost there Pin
Dirso13-Apr-09 8:46
Dirso13-Apr-09 8:46 
GeneralRe: Order Page... I'm almost there Pin
Yusuf13-Apr-09 13:55
Yusuf13-Apr-09 13:55 
GeneralRe: Order Page... I'm almost there Pin
Dirso14-Apr-09 2:13
Dirso14-Apr-09 2:13 
GeneralRe: Order Page... I'm almost there Pin
Yusuf14-Apr-09 9:14
Yusuf14-Apr-09 9:14 
QuestionWebServices/WSDL Pin
Mike Doner13-Apr-09 4:10
Mike Doner13-Apr-09 4:10 
AnswerRe: WebServices/WSDL Pin
Abhijit Jana13-Apr-09 4:53
professionalAbhijit Jana13-Apr-09 4:53 
GeneralRe: WebServices/WSDL Pin
Mike Doner13-Apr-09 4:58
Mike Doner13-Apr-09 4:58 
GeneralRe: WebServices/WSDL Pin
Abhijit Jana13-Apr-09 5:04
professionalAbhijit Jana13-Apr-09 5:04 
GeneralRe: WebServices/WSDL Pin
Mike Doner13-Apr-09 5:24
Mike Doner13-Apr-09 5:24 
GeneralRe: WebServices/WSDL Pin
Mike Doner13-Apr-09 6:56
Mike Doner13-Apr-09 6:56 
Questionupdate sql Pin
ptvce13-Apr-09 3:56
ptvce13-Apr-09 3:56 
AnswerRe: update sql Pin
mr_muskurahat13-Apr-09 4:12
mr_muskurahat13-Apr-09 4:12 
GeneralRe: update sql Pin
ptvce13-Apr-09 4:14
ptvce13-Apr-09 4:14 
AnswerRe: update sql Pin
Abhijit Jana13-Apr-09 4:50
professionalAbhijit Jana13-Apr-09 4:50 
Questionuse information of a page in another page Pin
Member 469760613-Apr-09 3:55
Member 469760613-Apr-09 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.