Determine Page Type

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

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
 
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
 
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
 
Back
Top