我在一个目录中有一个需要表单身份验证的Web服务(asmx文件)
当我尝试通过VS2005添加WebReference时,我收到以下错误:
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>
当我删除该目录中的web.config(基本上删除了表单身份验证的要求)时,一切正常。我可以添加WebReference。
知道吗?
将以下代码放入web.config中:
<location path="path/to/your/service.asmx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>
ASP。Net允许覆盖特定位置的应用程序范围设置。