views:

439

answers:

1

Hello,

I have a webservice (asmx file) in a directory requiring form authentication

When I try to add the WebReference through VS2005 - I get the following error:

The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/webchat/login.aspx?ReturnUrl=%2fwebchat%WebService.asmx">here</a>.</h2>
</body></html>

When I remove the web.config in that directory (and basically removing the requirement for form authentication) everything works fine. I can add the WebReference.

Any idea?

+2  A: 

Place the following code in your web.config:

<location path="path/to/your/service.asmx">
 <system.web>
  <authorization>
   <allow users="*"/>
  </authorization>
 </system.web>
</location>

ASP.Net allows to override application-wide settings for specific locations.

maxnk
Thanks it works. But is there a way I can use it as a webreference while still keeping the authorization requirement?
LeJeune
maxnk