Determine Page Type

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
 
M

Munna

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
 
J

Jonathan Wood

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top