oursgris
oursgris

Reputation: 2882

Disable web authentification in asp .net

I use ASP .Net 4 and I have a project using the form web authentication

<authentication mode="Forms">
  <forms loginUrl="~/" timeout="7200" />
</authentication>

I have a web service in the same project and I want to disable this web authentication for one page (a web service)

I tryed that code :

<location path="WSBaseCentrale.asmx" allowOverride="false">
  <system.web>
    <authorization>
      <allow users="?"/>
    </authorization>
  </system.web>
</location>

But I've a 302 redirection to the form logon. Is it possible to disable it ?

Edit

I tryied that and it doesn't work better. When I access to the page (http://localhost/App/WSBaseCentrale.asmx) I am always redirected to the form page (http://localhost/App/) with an HTTP 302 redirection.

<location path="WSBaseCentrale.asmx">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>

Edit 2

Some others facts :

Upvotes: 3

Views: 7652

Answers (3)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Remove allowOverride="false"

Also remove <allow users="?"/> and add it in place of <allow users="*"/>

Finally, make sure your webservice is in the root Directory, otherwise you have to specify the path accordingly.

Upvotes: 2

VMAtm
VMAtm

Reputation: 28355

<location path="WSBaseCentrale.asmx">
   <system.web>
     <authorization>
       <allow users="*"/>
     </authorization>
   </system.web>
</location>

Did you try this?


Also you should check the anonymous authentication settings for your IIS, may be you just can't view your site anonymously.

Upvotes: 2

Alex Aza
Alex Aza

Reputation: 78447

This works on my web site

<location path="Services">
  <system.web>
    <authorization>
      <allow users="*"/>
    </authorization>
  </system.web>
</location>

Upvotes: 2

Related Questions