CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/1/2006 8:32:18 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 140 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
ryanr
Asp.Net User
Bug with MasterPages and UserControl OutputCache Shared=False?3/1/2006 8:32:18 PM

0

The problem is that OutputCache Shared=False (cache sep version for each page) does not work with MasterPages. Well, at least not how I think it should work.

Instead of caching a seperate version of the user control for each .aspx page, it simply caches a single version of each user control for the .master page. This makes fragment caching totally useless if you require the control to change depending on what page it is on, but still want it cached. Such as having user controls with runat=server images with root-relative paths and you use the same master page over multiple directories.

Example:

Page1 (/index.aspx) uses Master.master which has a UserControl (say like a header) with an Image of path "~/images/test.gif". This UserControl also outputs the page path.

Page2 (/folder/index.aspx) uses the same Master.master.

If you request Page1 first, your image gets cached as "images/test.gif" and you see output "/index.aspx".

When you request Page2 your image path is still "images/test.gif" and thus incorrect and you still see output "/index.aspx".

If I disable the OutputCache of the UserControl everything works fine.

Shouldn't Shared=False create unique cache per .aspx file and not .master file?? Is there a workaround that I could use where I don't have to have the cached UserControl referenced in each Child page instead of only once in the MasterPage? 

Like is there any kind of static property I can access about the page and thus use a varyByCustom="PageChecker" in the UserControl? Request.Path won't be available from what I can tell...

ryanr
Asp.Net User
Re: Bug with MasterPages and UserControl OutputCache Shared=False?3/6/2006 5:50:30 PM

0

Ok, so I found a workaround. Request.Path will be available after all...

In global.asax I override:

Public Overrides Function GetVaryByCustomString(ByVal context As HttpContext, ByVal arg As String) As String

If (arg.ToLower = "page") Then

Return context.Request.Path

Else

Return MyBase.GetVaryByCustomString(context, arg)

End If

End Function

Then, my user control outputcache declaration looks like so:

<%@ OutputCache Duration="30" VaryByParam="none" VaryByCustom="page" Shared="false" %>

Why shared=false doesn't behave like my varybycustom=page to begin with... the world may never know...

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Bug with MasterPages and UserControl OutputCache Shared=False ... Bug with MasterPages and UserControl OutputCache Shared=False? Last post 03-06- 2006 12:50 PM by ryanr. 1 replies. Sort Posts: ...
Bug with MasterPages and UserControl OutputCache Shared=False ... The problem is that OutputCache Shared=False (cache sep version for each page) does not work with MasterPages. ...
aspnet caching Most Recent Posts I have a user control that is referenced directly by the master page. ... When I set the usercontrol to use outputcache with varybyparam = none the links don't work! ... The declaration in the control is: <%@ OutputCache Shared="true" ... attribute to false in the element under , which . ...
Teddy's Programming Lab : ASP.NET의 하기 쉬운 10가지 실수(E) Before the advent of Master Pages, developers employed user controls to factor out common ... So, here뭩 code that works great without an OutputCache directive , .... NET 1.x, passing RedirectFromLoginPage a second parameter equal to false issues a ... The helper method is a work-around for another bug in ASP. ...
.NET ASP [Archive] - Page 46 - bytes FindControl non-Shared member · Error with simple aspnet app · profile and webservices .... Master Pages and Usercontrols - object reference not set · Data Reader Now Rows ... *WITHOUT* using: ValidateRequest="False" for the whole page (or my whole site). .... Object Must Implement IConvertible is a BUG non solved? ...
.NET ASP [Archive] - Page 37 - bytes Bug? Strange between Wizard control and client javascript code .... Getting the server-adjusted ID of a repeated user control ... Stopping Formview insert command button - too late to trigger isvalid=false ??? viewstate lost after update ... referencing files outside of web application with master page ...
Keep Your Sites Running: 10 Common ASP.NET Pitfalls to Avoid Before the advent of Master Pages, developers employed user controls to ... The following code loads the user control and assigns a value to BackColor: ... If the ASCX file lacks an OutputCache directive, LoadControl returns a MyUserControl reference. .... The helper method is a work-around for another bug in ASP. ...
ASP.NET - Nick Berardi’s Coder Journal In the sample code above, the filter is the attribute called OutputCache. ... or ascx file is picked from the controller or Shared directory in Figure 2-24. ... are still available in the MVC version of the page, user control, and master page. ...... NET MVC PR5 with a couple bug fixes. So the good news is that the ...
.Net Interview Questions, Resources, Tips & Tricks. archive: July 2008 Jul 1, 2008 ... Sessions can be shared between ASP.Net and Classic ASP. ...... It defaults to false but should be set to true in any ASPX file ... NET user control is authored declaratively and persisted as a text file with an .ascx extension ... For caching the whole page the page should have OutputCache directive ...
ASP.NET Wiki: State Management: Application and Cache: Caching in ... Feb 7, 2009 ... Then the OutputCache directive is included in the user control file. ...






message is not going

what control to use on a message board?

regex password

how to disable keep-alive in .net 2.0

creating ftp accounts

read data from dropdownlist box

../ symbols for directory

email validation of multiple emails

creating and writing to a local database

user control in vb.net clarification needed

drop down calendar

object does not match target type?

what type shoud i use to return 00,00 format

passing generic objects

how can i work with rs232 in asp.net?

arraylist elements

how to pass the correct ip address of a thin client

text editor

how to have the built-in web server running when not in debug mode? vs2005 professional

wmp 11 in an asp.net web page

looking for better ui design

master detail form

how to play or embed a sound(.wav or otherwise) file within an aspx page

adding a reference to my dataset in my webfrom

i can't view my image on my webpage

navigator buttons question

alter date/time

problems finding controls in general. out of luck.....

login and membership

solution / project setup in vs

   
  Privacy | Contact Us
All Times Are GMT