在我的asp.net网络表单应用程序中,我在根级别添加了一个文件夹" WebAPI"它有一个web api控制器,它通过令牌进行身份验证。 asp.net web格式应用程序具有表单身份验证。当我从休息客户端调用api时,它会重定向到登录页面。
API响应: -
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/Login/Default.aspx? ReturnUrl=%2fapi%2fcustomer%2fGetSmsCount">here</a>.</h2>
</body></html>
根级别web.config: -
<location path="WebAPI"> <system.web> <authorization> <allow users="?"/>
</authorization> </system.web> </location> <system.web><authorization>
<deny users="?" /></authorization> </system.web>
我已经在webapi文件夹上授予匿名访问权限,但仍然会重定向到登录页面。
答案 0 :(得分:0)
检查您是否给出了正确的API路径