我想在MVC4中使用.new内置安全性和身份验证方法与azure存储一起使用,意思是,我不想在SQL数据库上创建用户,而是想在Azure存储上创建用户,登录过程也是如此。 你怎么认为?这可能吗?
据我所知,我感觉默认情况下需要完整的 SQL Server 默认且功能最齐全的提供程序 ASP.NET 成员资格提供程序(SQL 成员资格提供程序、SQL 角色提供程序、SQL 配置文件提供程序)需要完整的 SQL Server。它们依赖于存储过程支持,它们依赖于 SQL Server 缓存依赖项,它们依赖于代理进行清理和维护。因此,主要的基于 SQL Server 的提供程序在 SQL Server CE 上不能很好地工作,也不能在 SQL Azure 上开箱即用,等等。
[链接]http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5- web-forms-and-asp-net-mvc-4-templates.aspx
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
try
{
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
WebSecurity.Login(model.UserName, model.Password);
return RedirectToAction("Index", "Home");
}
catch (MembershipCreateUserException e)
{
ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
最佳答案
关于asp.net-mvc - 如何将 .net MVC4 应用程序设置为使用 azure 存储而不是 sql server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13559978/