ASP.Net MVC 2窗体身份验证cookie的= QUOT; UseUri"同时提交授权失败 [英] ASP.Net MVC 2 Forms Authentication cookieless = "UseUri" while submit authorization fails

查看:108
本文介绍了ASP.Net MVC 2窗体身份验证cookie的= QUOT; UseUri"同时提交授权失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始与ASP.Net MVC 2的工作

I just started working with ASP.Net MVC 2.

我创建了一个新的ASP.Net MVC应用程序,并创建了一个车辆CONTROLER与LINQ连接一个数据库表。然后创建窗体身份验证机制,为应用程序,并尝试使用URI来代替它工作顺利饼干但是当我使用实用工具创建从一个CONTROLER创建视图提交表单,它只是不工作。该autherization得到了失败,并要求输入用户名和密码again.I已经加入是否授权属性控制器,从而获得授权的所有动作产生的授权机制。

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
    {

但是,如果我用饼干代替URI的正常工作。

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

在此先感谢...

推荐答案

我找到了问题和解决方案。

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.

查看plaincopy到clipboardprint?

view plaincopy to clipboardprint?

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

这篇关于ASP.Net MVC 2窗体身份验证cookie的= QUOT; UseUri"同时提交授权失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆