Using the Page class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MicroMoth

    #1

    Using the Page class

    Hi,
    For my application I am planning to build a base class for all my webforms,
    this class will be called SitePages.cs. Within this class there will be
    methods to retrieve page details from the database, page security, some site
    specific error handling and methods to retrieve content for the page from the
    database.
    My question is, can I use the Page class as a "base" class for my SitePages
    class and how do I call/use methods defined in Page.cs within the code
    behind classes of my webforms.
    (Bit of a newbie question I know)
    Thanks
  • Cor Ligthert

    #2
    Re: Using the Page class

    MicroMoth,

    The answer is simple. Keep in mind that a webform page is stateless, that
    means that it completly initialize everything again when it is posted back.

    You can use static C# or shared VBNet classes. However those exist for the
    application which means all users from who the sessions are still active. So
    it is not something as a winform where you can keep information.

    That does not mean that you cannot use those static/shared classes, but than
    you should from every variable make a seperated one for every user (with the
    session or a cookie). In my opinion is that a hell of a job.

    However when you have information that is for all users, by instance a
    static pricelist, companyinformat ion or something, than the static/shared
    classes can maybe help you.

    I hope this give some idea's

    Cor

    "MicroMoth" <stephen.adams@ forvus.co.uk>
    [color=blue]
    > Hi,
    > For my application I am planning to build a base class for all my
    > webforms,
    > this class will be called SitePages.cs. Within this class there will be
    > methods to retrieve page details from the database, page security, some
    > site
    > specific error handling and methods to retrieve content for the page from
    > the
    > database.
    > My question is, can I use the Page class as a "base" class for my
    > SitePages
    > class and how do I call/use methods defined in Page.cs within the code
    > behind classes of my webforms.
    > (Bit of a newbie question I know)
    > Thanks[/color]


    Comment

    Working...