views:

38

answers:

1

I have an asp.net web application that use FormsAuthentication. Now, the application has a WCF Service that need to use Basic Authentication.

So, I need to return the 401 status code, but everytime it's picked up by asp.net and redirecting me to the login page.

How could I disable this feature and finally being able to throw a 401 without intervention from the FormsAuthentication module?

+1  A: 

you can't mix modes in a single directory.

your app uses formsauth configured in the root, which is where your users access the site.

your service needs basic auth, place it in a subdirectory and configure basic auth in a web.config for that directory.

add a <location> tag to your root web.config to allow all users to access the service directory.

that should work for you.

if any of this is not clear, let me know.

Sky Sanders