Determine Page Type

Discussion in 'ASP .Net' started by Jonathan Wood, Jun 3, 2008.

  1. Okay, so I created a generic IHttpModule class to globally intercept
    Page_Init in order to set the page's theme based on the user's database
    settings.

    I have this working except one problem: I have some help pages, in a
    separate folder, that use a separate style sheet. Is there any way to detect
    these pages in my handler and not set the theme for these pages?

    Thanks.

    Jonathan
     
    Jonathan Wood, Jun 3, 2008
    #1
    1. Advertising

  2. I would be interested in your final solution to this.

    regards


    "Jonathan Wood" <> wrote in message
    news:%...
    > Okay, so I created a generic IHttpModule class to globally intercept
    > Page_Init in order to set the page's theme based on the user's database
    > settings.
    >
    > I have this working except one problem: I have some help pages, in a
    > separate folder, that use a separate style sheet. Is there any way to
    > detect these pages in my handler and not set the theme for these pages?
    >
    > Thanks.
    >
    > Jonathan
    >
     
    Microsoft Newsserver, Jun 3, 2008
    #2
    1. Advertising

  3. Jonathan Wood

    Munna Guest

    On Jun 3, 11:59 am, "Jonathan Wood" <> wrote:
    > Okay, so I created a generic IHttpModule class to globally intercept
    > Page_Init in order to set the page's theme based on the user's database
    > settings.
    >
    > I have this working except one problem: I have some help pages, in a
    > separate folder, that use a separate style sheet. Is there any way to detect
    > these pages in my handler and not set the theme for these pages?
    >
    > Thanks.
    >
    > Jonathan


    Hi

    you can use a simple trick
    use
    context.Request.FilePath of HttpContext to get the path
    and check wheither it is in your help path...
    and perform your operation

    private void Application_BeginRequest(Object source,
    EventArgs e)
    {
    // Create HttpApplication and HttpContext objects to
    access
    // request and response properties.
    HttpApplication application = (HttpApplication)source;
    HttpContext context = application.Context;
    string filePath = context.Request.FilePath;
    if (filePath.Contains("Help"))
    {
    //do some thing
    }
    }

    Best of luck

    Munna
    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
     
    Munna, Jun 3, 2008
    #3
  4. Okay. I actually set a hook for Page_PreInit so I don't have the
    BeginRequest arguments at that time. But
    HttpContext.Current.Request.FilePath seems to work just fine.

    Not sure if that is the most efficient solution but it certainly seems to
    work.

    Thanks!

    Jonathan

    "Munna" <> wrote in message
    news:...
    > On Jun 3, 11:59 am, "Jonathan Wood" <> wrote:
    >> Okay, so I created a generic IHttpModule class to globally intercept
    >> Page_Init in order to set the page's theme based on the user's database
    >> settings.
    >>
    >> I have this working except one problem: I have some help pages, in a
    >> separate folder, that use a separate style sheet. Is there any way to
    >> detect
    >> these pages in my handler and not set the theme for these pages?
    >>
    >> Thanks.
    >>
    >> Jonathan

    >
    > Hi
    >
    > you can use a simple trick
    > use
    > context.Request.FilePath of HttpContext to get the path
    > and check wheither it is in your help path...
    > and perform your operation
    >
    > private void Application_BeginRequest(Object source,
    > EventArgs e)
    > {
    > // Create HttpApplication and HttpContext objects to
    > access
    > // request and response properties.
    > HttpApplication application = (HttpApplication)source;
    > HttpContext context = application.Context;
    > string filePath = context.Request.FilePath;
    > if (filePath.Contains("Help"))
    > {
    > //do some thing
    > }
    > }
    >
    > Best of luck
    >
    > Munna
    > www.munna.shatkotha.com
    > www.munna.shatkotha.com/blog
    > www.shatkotha.com
     
    Jonathan Wood, Jun 3, 2008
    #4
  5. Jonathan Wood

    Munna Guest

    Munna, Jun 4, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gernot Frisch

    how to determine type-type?

    Gernot Frisch, Jan 12, 2005, in forum: C++
    Replies:
    3
    Views:
    400
    Ulrich Achleitner
    Jan 13, 2005
  2. heyo
    Replies:
    3
    Views:
    913
    Dan Pop
    Apr 1, 2004
  3. pete
    Replies:
    4
    Views:
    797
    Dan Pop
    Apr 2, 2004
  4. Peña, Botp
    Replies:
    1
    Views:
    241
    Robert Klemme
    Jan 24, 2004
  5. Rich
    Replies:
    6
    Views:
    131
    Peter
    Jan 24, 2004
Loading...

Share This Page