membership-provider

Connection string error using membership provider from WCF service

微笑、不失礼 提交于 2019-12-08 00:39:09
问题 The target is: I need a wcf method which will create user in the database. I am using membership provider. and My client is SmartPhone/mobile device. I wrote a method which will create user BUT when I test the method I get the following error. error: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax. Parameter name: connectionString And I get

ConfigurationErrorsException “Thread was being aborted” on Membership.Provider

谁都会走 提交于 2019-12-07 19:30:25
问题 Occasionally on app restart this error will occur: System.Configuration.ConfigurationErrorsException - System.Web, Thread was being aborted. (C:\Inetpub\web.config line 417) at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Provider() ... When it does the app needs to be restarted to clear the error, every page request after this raises the same bug. Line 417 is the Membrship provider add line in web.config. We're using the UpmMembershipProvider from MS

deny custom role

牧云@^-^@ 提交于 2019-12-07 16:02:15
问题 how can i deny access to call method. something like this [HandleError] [Authorize(Roles = "role1, role2")] public class AdminController : Controller { [Deny(Roles = "role2")] public ActionResult ResultPage(string message) { ViewData["message"] = message; return View(); } } 回答1: You could simply do it the other way around and check for the presence of role1 instead of the absence of role2. Alternatively you could develop your own DenyAttribute that does what you want and verifies that the

Testing Membership provider without ASP.NET

拟墨画扇 提交于 2019-12-07 04:20:43
问题 I have a ASP.NET MVC site using Membership Provider. I have trouble testing some functionalities including register a new user. The ASP.NET website doesn't have a way to delete/remove a registered user, so in my testing project (WatiN with NUnit), I am trying to delete a testing user account by calling Membership.DeleteUser(). Then I realize I cannot use this since I cannot configure the membership provider with web.config in my NUnit project (in visual studio). How do I configure the

How to Display Validation Error Messages on an ASP.NET MVC Page?

て烟熏妆下的殇ゞ 提交于 2019-12-07 03:09:36
问题 I am pretty new to ASP.NET and C# I have spent the day learning the basics of the ASP.NET Membership provider I have built all my validator but are getting stuck at outputting my error message on the page. private void LogCreateUserError(MembershipCreateStatus status, string username) { string reasonText = status.ToString(); switch (status) { case MembershipCreateStatus.DuplicateEmail: case MembershipCreateStatus.DuplicateProviderUserKey: case MembershipCreateStatus.DuplicateUserName:

C# MembershipUser.ChangePassword fails for one user only?

被刻印的时光 ゝ 提交于 2019-12-06 17:45:29
I'm using the change password feature of the standard AspNetSqlMembershipProvider in my ASP.NET MVC-2 app: MembershipUser user = Membership.GetUser(userId); string pwd = user.ResetPassword(); if (user.ChangePassword(pwd, confirmPassword)) { // it worked } And this works for the vast majority of users, but there are a couple of users that can not change their passwords - user.ChangePassword() just returns false. I've tried it myself to see what was going on, and entered a simple password 12345678 for that user and it failed to change. So it's not because they are entering passwords that do not

Extending the RoleProvider GetRolesForUser()

北城以北 提交于 2019-12-06 15:52:45
The GetRolesForUser() method in the RoleProvider takes the user login name and returns the list of roles for that user. But in my application this is not enough, I need a few more pieces of information to be able to get the user's roles. How can I get this extra information into the method? I have it in the Session , but I found out that Session is not available in the RoleProvider . What I had in mind was putting this extra info in some class that extends MembershipUser , assuming I can get to it inside the RoleProvider . But I don't know how to create the CustomMembershipUser and make it

How to add retry logic to ASP.NET Membership Provider for Azure SQL?

时间秒杀一切 提交于 2019-12-06 06:11:04
问题 We have a database of ASP.net sqlMembershipProvider based users on an Azure SQL database. It has become apparent that the out of the box sqlMembershipProvider 4.0 does not have the required retry logic for Azure SQL connections which can drop out due to throttling or can expire. It is possible to implement our own membership provider that has this functionality but it would have to be exactly the same database interactions as the standard sqlMembershipProvider 4.0 in order to work with the

ConfigurationErrorsException “Thread was being aborted” on Membership.Provider

这一生的挚爱 提交于 2019-12-06 06:04:57
Occasionally on app restart this error will occur: System.Configuration.ConfigurationErrorsException - System.Web, Thread was being aborted. (C:\Inetpub\web.config line 417) at System.Web.Security.Membership.Initialize() at System.Web.Security.Membership.get_Provider() ... When it does the app needs to be restarted to clear the error, every page request after this raises the same bug. Line 417 is the Membrship provider add line in web.config. We're using the UpmMembershipProvider from MS Commerce Server, but it doesn't seem to be hitting this code, it's dying on the

Connection string error using membership provider from WCF service

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 05:46:20
The target is: I need a wcf method which will create user in the database. I am using membership provider. and My client is SmartPhone/mobile device. I wrote a method which will create user BUT when I test the method I get the following error. error: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax. Parameter name: connectionString And I get this error in the following line: Membership.CreateUser(name, password,email,"question","answer",true,out