Ask a Question related to ASP.NET General, Design and Development.

  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.1804@TK2MSFTNGP11.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. Similar Questions and Discussions

    1. Access Code Log In Page
      Here's what I'm attempting to do: I need to have a page that has a text box where someone can enter one word or a set numbers. Then when thye...
    2. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
      I am trying to print an Access 2002 report (Windows XP OS) as a PDF. I had success with Access 2000 in a Windows 2000 environment, but as soon as I...
    3. Newbie needs code pages for SQL Server 2000 access from asp.net page using vb.net
      I am only trying to connect to a local host . I am on Windows 2000 Server with sql 2000 server. My error is the classic "SQL server does not...
    4. how to pass an access DB query onto *next* page? trouble with *next* and *previous* querystring code
      Don;t see any sign of any paging code is your snippets normally take this form Set rso = Server.CreateObject("ADODB.Recordset") rso.PageSize =...
    5. Storing ASP code in a Access mdb memofield and insert it in a asp-page
      "Chris Hohmann" <hohmannATyahooDOTcom> schreef in bericht news:eStRtmfPDHA.2480@tk2msftngp13.phx.gbl...
  3. #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

  4. #3

    Default Re: Code Access to page

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


    "Mike S" <mikes@n-o.sp-a.m.pac.odedodea.edu> wrote in message
    news:Ofe6BZoSDHA.1556@TK2MSFTNGP10.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.1804@TK2MSFTNGP11.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

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139