views:

39

answers:

1

Is there any way of doing something like this?

<location path="/(view|edit)post.aspx\?id=[7-9][0-9]+">
    <system.web>
      <authorization>
        <allow roles="AdminPublishers"/>
        <deny users="*"/>
      </authorization>
    </system.web>
</location>

Authorization is just an example. I would like to be able to do other things with those locations.

A: 

You could use an HttpModule and attach a handler to the AuthenticateRequest event. Inside your handler, use your Regex to match against the incoming Request Url, and if it matches, check the roles of the user who is currently logged in. You could also set it up to read configuration from the Web.config, if that's what you're after.

dave thieben
Hi. That would be fine if I just needed to authorize users but I want change other system.web settings for location that matches.
Eduardo
ah, I see. Have you tried putting a web.config in the location, with the overriding settings? http://msdn.microsoft.com/en-us/library/ms178685.aspx
dave thieben
I'm not 100% clear on what you're trying to do. Are you trying to apply security to an HttpHandler(s) or just get some up and running?
Adrian K
Not only security but other settings available under system.web tag.
Eduardo