使用microsoft.web.helpers登录后重定向改变 [英] login redirect changed after using microsoft.web.helpers

查看:90
本文介绍了使用microsoft.web.helpers登录后重定向改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个asp.net MVC3的网站,我进口microsoft.web.helpers,webmatrix.data和webmatrix.webdata。在那之后,我发现,当我使用[授权]属性在控制器的一些ActionResults,我重定向分占\\用户名和不能解释\\登录这正是它已经做过并且是默认的。

我不使用WebMatrix中,但想用microsoft.web.helpers功能。我搜索在code凡提述帐户\\登录,但没有任何我可以找到。我对认证的web配置如下图所示:

 <身份验证模式=表格>
  <形式loginUrl =〜/帐号/登录超时=2880/>
< /认证>


解决方案

要覆盖使用:

 <结构>
  <&的appSettings GT;
    <添加键=loginUrlVALUE =〜/帐号/登录/>
  < /的appSettings>
< /结构>

从<一个href=\"http://www.redmountainsw.com/word$p$pss/archives/webmatrix-redirects-unauthorized-pages-to-accountlogin\">http://www.redmountainsw.com/word$p$pss/archives/webmatrix-redirects-unauthorized-pages-to-accountlogin

In an asp.net mvc3 website, I imported the microsoft.web.helpers, webmatrix.data, and webmatrix.webdata. After that, I have found that when I use the [Authorize] attribute on some ActionResults in Controllers, my redirect points to account\login and not account\logon which is what it had done before and is the default.

I'm not using WebMatrix but would like to use the microsoft.web.helpers functionality. I've searched in code for any reference to account\login but there isn't any I could find. My web config for authentication is shown below:

 <authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

解决方案

To override use:

<configuration>
  <appSettings>
    <add key="loginUrl" value="~/Account/Logon" />
  </appSettings>
</configuration>

From http://www.redmountainsw.com/wordpress/archives/webmatrix-redirects-unauthorized-pages-to-accountlogin

这篇关于使用microsoft.web.helpers登录后重定向改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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