ASP.Net MVC 2 Forms Authentication cookieless = “UseUri” while submit authorization fails

喜夏-厌秋 提交于 2019-12-08 12:50:13

问题


I just started working with ASP.Net MVC 2.

I created a new ASP.Net MVC application and created one vehicle controler with a database table connected with LINQ. Then created forms authentication mechanism for the application and tried to use the uri instead of cookies it was working smoothly but when i submit the form by creating a "Create" view from the controler using the utility it just dont work. The autherization got failed and asking to enter the user name and password again.I had created the authorization mechanism by adding Authorise attribute to the Controller so as to get authorized for all the actions.

namespace MVCNEW.Controllers
{    
    [Authorize]
    public class VehicleController : Controller
    {

But if i use the cookies instead of uri it works fine.

Thanks in advance...


回答1:


Please see http://forums.asp.net/p/1517391/3634908.aspx for an official response.

Summary: Cookieless Session support is essentially obsolete, and the MVC framework isn't likely to include additional support for it.




回答2:


I found the problem and a solution.

This was due to some error in the framework. They are not creating the Uri string for the Form action while calling

Html.BeginForm() 

But if we make it call overloading of this method like the providing the Controller name and Action name it is working fine.

view plaincopy to clipboardprint?

Html.BeginForm("Create","Vehicle") 


来源:https://stackoverflow.com/questions/2895819/asp-net-mvc-2-forms-authentication-cookieless-useuri-while-submit-authorizat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!