Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserControl caching

Status
Not open for further replies.

GoTerps88

Programmer
Apr 30, 2007
174
US
I am hosting a usercontrol on a masterpage that builds a dynamic menu based on the user name I retrieve based on the user's windows logon. I have a table in the database that retrieves role information based on their logon id.

I want to display this usercontrol based on the user's logon, which I have captured in a session object. Different users will have different menu items based on their role in the database.

I am not using the menu control shipped with ASP.NET. I'm using an Oracle database, which doesn't lend itself well to building a membership provider.

How should I approach building a fragment cached user control in this scenario that display a different cached user control based on the user's logon?
 
I seem to have gotten it working. I set the user control's VaryByControl property to a public string defined in the code file.

Then on the master page's load event I set the user control's property to the user's logon string. I remembered that you cannot access a user control's properties once it is cached, so I just check first to determine if the user control is null.

It seems to work for now, but I'll continue to test it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top