Asp.net Role manager tutorial
It is very useful in .net we can user framework provided role manager, and easily configure in Web.Config.
However, I find when I fullfil such configure:
<roleManager defaultProvider="QQmgsSqlProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="true"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<add
name="QQmgsSqlProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="TwitterDbContext"
applicationName="Twitter" />
</providers>
</roleManager>
When I send the Http request, I find the error:
{
"Message": "An error has occurred.",
"ExceptionMessage": "The Role Manager feature has not been enabled.",
"ExceptionType": "System.Configuration.Provider.ProviderException",
"StackTrace": " at System.Web.Security.Roles.EnsureEnabled()\r\n at Twitter.App.Controllers.APIControllers.PingController.Get() in C:\\Users\\Administrator\\Downloads\\Twitter-master\\Twitter-master\\QQmgs.App\\Controllers\\APIControllers\\PingController.cs:line 19\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.AuthenticationFilterResult.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"
}
So, after my investigation, I find there's one more thing I should do.
"It looks like your membership database is missing some required procedures required for the membership system.
You need to run VS command prompt and type this command "aspnet_regsql.exe" and link it to your database. This command will populate your database with all required database objects for the membership system."
refer to: https://forums.asp.net/t/2048614.aspx?Could+not+find+stored+procedure+dbo+aspnet_CheckSchemaVersion+
After I follow the instruction below, I find in my database there's some new tables like: "aspnet_Roles, aspnet_Membership".
Then I resend the Http request to test, succeeded !
Asp.net Role manager tutorial的更多相关文章
- Developing a Custom Membership Provider from the scratch, and using it in the FBA (Form Based Authentication) in SharePoint 2010
//http://blog.sharedove.com/adisjugo/index.php/2011/01/05/writing-a-custom-membership-provider-and-u ...
- [转] JSON Web Token in ASP.NET Web API 2 using Owin
本文转自:http://bitoftech.net/2014/10/27/json-web-token-asp-net-web-api-2-jwt-owin-authorization-server/ ...
- JSON Web Token in ASP.NET Web API 2 using Owin
In the previous post Decouple OWIN Authorization Server from Resource Server we saw how we can separ ...
- 【ASP.NET Identity系列教程(二)】运用ASP.NET Identity
注:本文是[ASP.NET Identity系列教程]的第二篇.本系列教程详细.完整.深入地介绍了微软的ASP.NET Identity技术,描述了如何运用ASP.NET Identity实现应用程序 ...
- asp.net资料! (.NET) (ASP.NET)
使用SqlBulkCopy类加载其他源数据到SQL表 在数据回发时,维护ASP.NET Tree控件的位置 vagerent的vs2005网站开发技巧 ASP.NET2.0小技巧--内部控件权限的实现 ...
- asp.net用户身份验证时读不到用户信息的问题 您的登录尝试不成功。请重试。 Login控件
原文:asp.net用户身份验证时读不到用户信息的问题 您的登录尝试不成功.请重试. Login控件 现象1.asp.net使用自定义sql server身份验证数据库,在A机器新增用户A,可以登录成 ...
- 使用IIS应用程序初始化来保持ASP.NET应用程序的活动
https://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET ...
- ASP.NET Identity 二 (转载)
来源:http://www.cnblogs.com/r01cn/p/5180892.html#undefined 推荐看原文,这里转载是怕好文章消失了. 注:本文是[ASP.NET Identity系 ...
- 提高ASP.NET网站性能的方法
http://www.360doc.com/content/14/0705/18/7662927_392224856.shtml Asp.NET有许多秘密,当你了解了这些秘密后,可以使得你的ASP ...
随机推荐
- OpenGL绘制简单场景,实现旋转缩放平移和灯光效果
本项目实现了用OpenGL绘制一个简单场景,包括正方体.球体和网格,实现了物体的旋转.缩放.平移和灯光效果.附有项目完整代码.有具体凝视.适合刚開始学习的人熟悉opengl使用. 开发情况 开发环境V ...
- Extjs4 操作TreeStore 处理proxyAjax 获取的数据
近期在搞extjs4 TreeStore时有一个需求 就是要处理一下后台传过来的json数据然后再显示,看api也没有找到解决的方法 ,最后看源代码在Ext.data.proxy.Server 看到这 ...
- golang 之 defer(统计函数执行时间)
package main import ( "fmt" "time" ) func sum(a ...int) int { defer trace(" ...
- 如何在其他类中实现继承自CFormView类的对象
今天项目开发中,我们创建了一个对话框资源,并创建了一个派生自CFormView的类(假设为CMyClassDlg)来管理它. CMyClassDlg.h #pragma once // CMyClas ...
- 关于group by的一段SQl语句——Oracle
select cc.fformulacode, cc.rangedate, dd.fpervalue from (select n1.fformulacode, max(n1.frangedate) ...
- SGU 506.Subsequences Of Substrings
求一个串S有多少子串subS满足s是subS的子序列.len(S)<=100000, len(s)<=100 直接扫一遍... ------------------------------ ...
- Android快速开发框架——AndroidAnnotations(Code Diet)
简介:AndroidAnnotations是一个依赖注入方式来简化代码结构 ,快速开发的开源框架,使结构代码更清晰,减少代码重复性.对今后我们做自动化测试和自动化埋点开发都会提高开发效率.跟我们之前使 ...
- C功底挑战Java菜鸟入门概念干货(一)
一.认识Java 1.Java 程序比较特殊,它必须先经过编译,然后再利用解释的方式来运行. 2.Byte-codes 最大的好处是——可越平台运行,可让“一次编写,处处运行”成为可能. 3.使用 ...
- Summer Holiday(强联通入度最小点)
Summer Holiday Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- request.getParameterValues与request.getParameter的差别
一. 简单的对照 request.getParameter用的比較多,相对熟悉 request.getParameterValues(String name)是获得如checkbox类(名字同样, ...