什么是preserveLoginUrl appSetting键/值在ASP.NET MVC应用程序? [英] What is the PreserveLoginUrl appSetting key/value in an ASP.NET MVC application?
问题描述
我正在审查一些 ASP.NET MVC
code,特别是一个web.config文件。
I was reviewing some ASP.NET MVC
code, specifically a web.config file.
我在的appSettings
部分注意到了这一点:
I noticed this in the appSettings
section:
<添加键=preserveLoginUrl值=真/>
- 这是什么呢?
- 当被介绍给ASP.NET MVC?
干杯!
推荐答案
从 MVC 4白皮书
当WebMatrix.WebData.dll被包括在一个ASP.NET MVC应用程序4的/ bin目录中,它接管的URL,表单验证。添加WebMatrix.WebData.dll组装到应用程序(例如,通过选择ASP.NET Web页面剃刀语法使用添加部署依赖性对话时)将覆盖验证登录重定向到/帐号/登录,而不是/账户/登录预期由默认的ASP.NET MVC账户控制器。为prevent这种行为,并使用在web.config中的认证部已指定的URL,可以添加一个名为appSetting preserveLoginUrl并将其设置为true
When WebMatrix.WebData.dll is included in in the /bin directory of an ASP.NET MVC 4 apps, it takes over the URL for forms authentication. Adding the WebMatrix.WebData.dll assembly to your application (for example, by selecting "ASP.NET Web Pages with Razor Syntax" when using the Add Deployable Dependencies dialog) will override the authentication login redirect to /account/logon rather than /account/login as expected by the default ASP.NET MVC Account Controller. To prevent this behavior and use the URL specified already in the authentication section of web.config, you can add an appSetting called PreserveLoginUrl and set it to true
这篇关于什么是preserveLoginUrl appSetting键/值在ASP.NET MVC应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!