<location> element in web.config file. Has anyone run into this before?

A

alexvodovoz

Hi,

I have been struggling with this for the past couple of days. We have
a custom http module setup in our project to filter some requests. I
only want this module to be applied to certain pages. In order to try
to do this I have added the following test code in our web.config
file.

<location path="Login.aspx">
<system.web>
<httpModules>
<add type="AppTest.WebUI.RequestFilter, AppTest"
name="RequestFilter" />
</httpModules>
</system.web>
</location>

However when I visit the login.aspx page the module doesn't get
executed. Note, that if I change the path to be nothing, for example:.

<location path="">
<system.web>
<httpModules>
<add type="AppTest.WebUI.RequestFilter, AppTest"
name="RequestFilter" />
</httpModules>
</system.web>
</location>

the module executes perfectly however it is applied to every page and
not just the login.aspx page. I have tried pretty much every
combination in the path attribute. Things like "~/login.aspx",
"AppTest/login.aspx", etc. and nothing seems to work. Has anybody
come across this issue before, specifically with trying to apply
access permissions to an httpModule. I've seen a lot of examples with
the authorization element being used, but that is about it. Any help
would be greatly appreciated. I am using asp.net 1.1, IIS 5.1
 
B

bruce barker

location filtering is not supported for httpmodules. if you install a
httpmodule, it will be called on all requests (or none if you specify a
path). you will need to add the filtering to your module.

while this is probably a bug, it is now a "known" behavior and will not
fixed in the next release.

-- bruce (sqlwork.com)
 
G

Guest

location filtering is not supported for httpmodules. if you install a
httpmodule, it will be called on all requests (or none if you specify a
path). you will need to add the filtering to your module.

while this is probably a bug, it is now a "known" behavior and will not
fixed in the next release.

-- bruce (sqlwork.com)










- Show quoted text -

Agree with Bruce. As a solution you may want to try get the url in the
http module and execute a code if Request.RawUrl will be equal to
"Login.aspx".
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top