Re: How to bypass Forms Authentication on selected pages programma



Hey Joe, thanks for the last post.

I am using the following code in Global.asax:
Private Sub Global_AuthenticateRequest(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.AuthenticateRequest
Dim instance As HttpContext
If Request.Path = "/TestProject/FileUpload.aspx" Then
instance.SkipAuthorization = False
End If
End Sub

I know what you said seems very staright forward. But it hasn't worked in my
case yet. I know I am missing something somewhere. I have tried this in
Application_AuthenticateRequest as well. Let me know

Appreciate your help,
AJ
"Joe Kaplan" wrote:

Not the query string, but the Request.Url or Request.Path property. I don't
really have a sample for you, but basically your code would do this:

In the appropriate event (probably the Authenticate event so this runs after
authentication but before authorization) check the Url of the Request to see
if it matches one of the resources you want to exclude. If so, set
SkipAuthorization to false. Be very careful with how you do the matching of
the path against your list of exclusions. There isn't really much to it.
Just play around with it. :)

There are also probably some fancier ways you can do this. You might apply
some kind of marker to the actual page via a base class, marker interface or
custom attribute on your pages and determine that from the IHttpHandler that
is set up in the HttpContext for the request. I haven't tried that, but I
don't see why it wouldn't work. Part of it depends on how you want to
maintain the list of excluded resources. If you want to do this from the
code in the page, I'd take this approach. If you want to maintain a list of
their URLs, then the previous approach is better. However, that kind of
thing might be easier to deal with through the standard location tags in
web.config.

I'm curious if Dominick (or anyone else) sees this thread and has a strong
opinion about this.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"ajmehra" <ajmehra@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7E76E7BF-60DC-441D-9A43-841CBBE0087E@xxxxxxxxxxxxxxxx
Thanks Joe.

Do you have an example of this property being used in Global.asax? I am
not
sure about how to check to see if -- this is the right page to be left
out
for authentication.

Should I use a QueryString for this check?


Thanks again
AJ

"Joe Kaplan" wrote:

Use the HttpContext.SkipAuthorization property to turn authorization on
or
off programmatically on a page by page basis. You probably want to put
this
code in global.asax or an IHttpModule.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"
http://www.directoryprogramming.net
--
"ajmehra" <ajmehra@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A9894367-B2BC-496D-9FD7-057381022AC6@xxxxxxxxxxxxxxxx
Hi

I am trying to bypass Forms Authentication on certain pages
programmatically. Any thoughts will be appreciated.

Thanks,
AJ






.



Relevant Pages

  • Re: Disable Kerberos in a Windows Server 2003 Environment
    ... Thanks Joe! ... It is definitely possible to prevent Kerberos ... authentication to a given service by making sure the service principal name ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)
  • Re: Domain registration requirement in federated web sso with fore
    ... Thanks a lot Joe for this useful information. ... We have some applications, written in non microsoft languages like Java, ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... internet, then the DNS entries for the resources will need to be ...
    (microsoft.public.windows.server.active_directory)
  • Re: Error setting DirecotrySearchers new ExtendedDN
    ... Thanks Joe, but now I'm worried and confused. ... 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, ... The .NET Framework does not support all versions of every platform. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.platformsdk.security)
  • Re: ADAM Authentication
    ... Only using ADAM for testing a proof-of-concept; ... "Joe Kaplan" wrote: ... Note that using S.DS for authentication may cause you scalability problems ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)
  • Re: How to get user id guid
    ... Joe Kaplan-MS MVP Directory Services Programming ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... UserProfileManager upm = new UserProfileManager; ... I am developing a SSO web part between a SharePoint site and my web ...
    (microsoft.public.dotnet.security)