Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Session & ViewState Variables validation
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344804
Message ID:
01344844
Views:
11
>Paul,
>
>Thank you very much for your professional advise. How about doing this in a Page_Load event of the Master Page since all my pages are using Master Page? Does that sound like a good place for the validation?
>

Page_Load may not happen early enough for all of your code. If you use these variables in a lot of places, you might want to just create a property on your baseclass of your code-behind (assuming you have a baseclass and aren't just using the default class), ex.:
' Instead of:

Public Partial Class MyWebPage
  Inherits System.Web.UI.Page

' It would be (assuming you've defined the base page class)
Public Partial Class MyWebPage
  Inherits MyNamespace.Web.MyBasePage
That's actually what do for a few session-bound values I use in my apps.

If you don't have a base page (and don't want to retrofit it, although it's pretty easy to do a search/replace for this kind of thing) I'd suggest putting it in the Page_Init of the master page. However, accessing a property on the master page isn't seemless since you'd need to cast the master page to your actual master page type before you'd be able to access the property.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform