Mukesh Agarwal
Mukesh Agarwal

Reputation: 412

Create/Access Custom Configuration Section from location tag of web.config

I want to add some setting for various location and also want to access that per page basis

<location path="Account" myAttr="true">
  <system.web>
     <authorization>
        <allow users="*" />
     </authorization>
  </system.web>
</location>

Or I want to use

<location path="Account">
  <myNode>true</myNode>
  <system.web>
     <authorization>
        <allow users="*" />
     </authorization>
  </system.web>
</location>

Now I want to access this setting in code. I am using MVC3 with ASP.net 4.0 . I found an MSDN article on Custom Sections .

http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

I am not able to use that in location tags.

Upvotes: 0

Views: 553

Answers (1)

ParPar
ParPar

Reputation: 7549

You can try to add ~ to the path : <location path="~/Account/LogIn">

and I didn't use any true... (and it works well).

Maybe you should add suitable class and attributes.

Upvotes: 1

Related Questions