YourBasePage.vb ----> System.Web.UI.Page. Once done, you can Override OnInit on System.Web.UI.Page in YourBasePage.vb to do whatever you want...make sure to call mybase.OnInit() (or base.OnInit(); in c#). Check out: [url]http://www.devarticles.com/art/1/304/2[/url] for an example. Karl "Vincent V" wrote in message news:eix2sUfSDHA.1804@TK2MSFTNGP11.phx.gbl...[quote] > Hey guys, > I am about to start a project and i want to be able to have as much[/quote] control[quote] > over > the project as i can in a OOP approach > > i am wondering if there is anyway i can run some code on every page of my > application > is there anyway to do this rather than passing the Page object into a[/quote] global[quote] > function(class) > ie > on page load > myclass.myfunction(page) > > the reason i am wanting to do this is because at a later stage i want to > implement Page Visit statistics and maybe some other things > > > ANy ideas on this how i can have code access to everypage in my[/quote] application[quote] > > Thanks > >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Karl Seguin [ip] => [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Code Access to page - ASP.NET General

Code Access to page - ASP.NET General

There are a couple methods....first you could make use of some application events in global.asax such as Begin Request. However, I would recommend creating your own class that inherits from System.Web.UI.Page, and have all your aspx pages inherit from your class. Index.aspx.vb -----> YourBasePage.vb ----> System.Web.UI.Page. Once done, you can Override OnInit on System.Web.UI.Page in YourBasePage.vb to do whatever you want...make sure to call mybase.OnInit() (or base.OnInit(); in c#). Check out: [url]http://www.devarticles.com/art/1/304/2[/url] for an example. Karl "Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message news:eix2sUfSDHA.1804TK2MSFTNGP11.phx.gbl... > Hey guys, > I am about to start a project and i want to be able ...

  1. #1

    Default Re: Code Access to page

    There are a couple methods....first you could make use of some application
    events in global.asax such as Begin Request.

    However, I would recommend creating your own class that inherits from
    System.Web.UI.Page, and have all your aspx pages inherit from your class.

    Index.aspx.vb -----> YourBasePage.vb ----> System.Web.UI.Page. Once done,
    you can Override OnInit on System.Web.UI.Page in YourBasePage.vb to do
    whatever you want...make sure to call mybase.OnInit() (or base.OnInit(); in
    c#).

    Check out: [url]http://www.devarticles.com/art/1/304/2[/url] for an example.

    Karl

    "Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message
    news:eix2sUfSDHA.1804TK2MSFTNGP11.phx.gbl...
    > Hey guys,
    > I am about to start a project and i want to be able to have as much
    control
    > over
    > the project as i can in a OOP approach
    >
    > i am wondering if there is anyway i can run some code on every page of my
    > application
    > is there anyway to do this rather than passing the Page object into a
    global
    > function(class)
    > ie
    > on page load
    > myclass.myfunction(page)
    >
    > the reason i am wanting to do this is because at a later stage i want to
    > implement Page Visit statistics and maybe some other things
    >
    >
    > ANy ideas on this how i can have code access to everypage in my
    application
    >
    > Thanks
    >
    >

    Karl Seguin Guest

  2. #2

    Default Re: Code Access to page

    Vincent V wrote:
    > Hey guys,
    > I am about to start a project and i want to be able to have as much
    > control over
    > the project as i can in a OOP approach
    >
    > i am wondering if there is anyway i can run some code on every page
    > of my application
    > is there anyway to do this rather than passing the Page object into a
    > global function(class)
    > ie
    > on page load
    > myclass.myfunction(page)
    >
    > the reason i am wanting to do this is because at a later stage i want
    > to implement Page Visit statistics and maybe some other things
    >
    >
    > ANy ideas on this how i can have code access to everypage in my
    > application
    >
    > Thanks
    Apart from Karl's solution, you might also put your code in
    a user control (ascx file). Then you can insert this user control in
    every page that needs it. I have already used a user control before
    for page statistics.

    --

    Jos Branders


    Jos Guest

  3. #3

    Default Re: Code Access to page

    Hey where can i get some more info on this agregation?
    and httpHandlers
    Thanks


    "Mike S" <mikesn-o.sp-a.m.pac.odedodea.edu> wrote in message
    news:Ofe6BZoSDHA.1556TK2MSFTNGP10.phx.gbl...
    > I would also reccomend using the Page Inheritance model--but only when it
    > suits the functional requirement in question.
    >
    > I would reccomend:
    > Using it for setting up business objects, loading relative controls,
    aplying
    > templates, etc. Something else that may help you organize your "BasePages"
    > would be to create the functionality you are trying to acomplish in
    seperate
    > objects and then assess them through agregation; this tends to keep the
    > structure of your "BasePage" classes simpler and, therefore, easier to
    > maintain.
    >
    > However, don't forget about the handy HttpHandlers and HttpModules; a
    simple
    > and maintainable approach that could easily handle Page Visit Statistics.
    >
    > Mike
    >
    >
    > "Vincent V" <vincentv-n0-5pam-optushome.com.au> wrote in message
    > news:eix2sUfSDHA.1804TK2MSFTNGP11.phx.gbl...
    > > Hey guys,
    > > I am about to start a project and i want to be able to have as much
    > control
    > > over
    > > the project as i can in a OOP approach
    > >
    > > i am wondering if there is anyway i can run some code on every page of
    my
    > > application
    > > is there anyway to do this rather than passing the Page object into a
    > global
    > > function(class)
    > > ie
    > > on page load
    > > myclass.myfunction(page)
    > >
    > > the reason i am wanting to do this is because at a later stage i want to
    > > implement Page Visit statistics and maybe some other things
    > >
    > >
    > > ANy ideas on this how i can have code access to everypage in my
    > application
    > >
    > > Thanks
    > >
    > >
    >
    >

    Vincent V Guest

Similar Threads

  1. Access Code Log In Page
    By HawksQuest in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: July 4th, 10:35 AM
  2. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
    By Tony_VBACoder in forum Adobe Acrobat Windows
    Replies: 3
    Last Post: April 30th, 07:44 PM
  3. Replies: 9
    Last Post: September 11th, 05:45 PM
  4. Replies: 1
    Last Post: September 1st, 04:56 AM
  5. Replies: 2
    Last Post: July 2nd, 08:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •