RE: Programmatic Forms Authentication



Hi,

you can use Context.User.IsInRole() to check for the role of the user. If that fails you can call FormsAuthentication.RedirectToLoginPage

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

""Yuan Ren[MSFT]"" wrote:

For the current issue, my understanding is that you want to
management the authentication of the site. If I have misunderstood
anything, please feel free to let me know.

I think you misunderstood my question. I'm not asking how do I apply
forms authentication to a certain directory or file from the
web.config, I'm asking how do I appliy authentication and
authorization to a URL programmatically. For instance let's say I
have the following 2 URLs that I want to apply roles to:

http://myweb.com/doc.aspx?id=1

I want the following roll:
ServiceA
http://myweb.com/doc.aspx?id=2

I want the following roll:
ServiceB
I want the fact that these two URL's have these rolls to be managed in
a database and then when a request comes in for these URL's I want to
let forms authentication know what authorization and roles to apply to
that URL.

As far as I know, the "location" element in the web.config file can
be used for the directory or sub directories. I suggest you put the
pages which allow the authorized client to access into the same
directory. And then, you just need mark the path of the directory in
the web.config file. The following link is detail explanation about
the "location" element. I hope this will be helpful.

If you have any issues or concerns, please let me know. It's my
pleasure to be of assistance.

I appreciate your input here but it has no relevance to my question.
I know how to control authentication and authorization from the
web.config.

Thanks,
Tyler


.



Relevant Pages

  • asp.net vulnerability
    ... From: Windows NTBugtraq Mailing List ... More details on ASP.NET vulnerability ... There has been some confusion with the ASP.NET forms authentication issue ... authorization issue, not an authentication issue. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: application pool custom identity
    ... Kerberos becomes a possibility when the web server is in a Domain, ... The problem happens when the browser/server selects Kerberos authentication, ... LocalSystem credentials will work for Kerberos; custom AppPool Identity ... Authorization. ...
    (microsoft.public.inetserver.iis)
  • Re: Kerberos OpenLDAP Frontend
    ... Jonathan Javier Cordoba Gonzalez wrote: ... but then you are mixing the authentication with the authorization. ... A KDC with passwords and LDAP ...
    (comp.protocols.kerberos)
  • Re: ASP.NET Authentication exception case
    ... It doesn't seem to like the authorization tag underneath the location tag ... This section sets the authentication policies of the application. ... <!-- SESSION STATE SETTINGS ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ADAM - SSO and provisioning considerations
    ... ADAM and "custom" security principals and gives you ... for authentication, where you might ship some default providers (ADAM LDAP ... be used to link up to the authorization store. ... > customer's identity store is a non-MS directory, ...
    (microsoft.public.windows.server.active_directory)