asp.net-membership

Custom RoleProvider with MVC 2.0

I have a custom Membership and Role Provider that I am setting up within an application. In ASP .Net Webforms I utilize the same providers and when the app is compiled and run the providers are initialized because of the references in the web.config. When I move this to MVC and put break points in my "Initialize" methods for these cl...

Is it possible to store the ASPNETDB database in a separate project?

I'm building a web application in ASP.NET and I want to separate it into three layers: Presentation, Data and Business. I want to keep my database in the Data layer but I can't figure out a way to do that with the ASP.NET Memberships database (ASPNETDB.mdf). Is there any way to tell the site to reference a database file in another pro...

Asp.net Memebership Authorization without password

To authanticate users in Asp.net Membership we can call method FormsAuthentication.Authenticate(username, password) how can I do the same job (generate session, cookies and all other staff that Authanticate does) without users password? I'm trying to login user over facebook connect. User's facebook id is stored within the users dat...

ASP.NET Membership and Linq to SQL

I am wondering the best way about setting up asp.net membership in sql server to work well with linq to sql. I'd like to use the username field for the foreign key relationships and have linq to sql recognise the asp user property. I am having some problems getting relationships right between the users table and my other tables. Do I n...

Asp.net Membership - Accounts getting locked out

We're using the standard ASP.net membership features that come with asp.net. Certain accounts in our membership database have a "Locked Out" flag set to true - when/how does this happen? ...

Asp.net, Active Directory authentication not working

I'm having trouble getting AD authentication working on my website. I have the following test code that works fine : DirectoryEntry entry = new DirectoryEntry(srvr, usr, pwd); object nativeObject = entry.NativeObject; On my website I get an error "Your login attempt was not successful. Please try again.". I really haven't been able t...

What's the meaning of "_FORM" in ModelState?

Hello, I was going through the AccountController class (the default one). I noticed that "_FORM" is used at many places with the ModelState. For, isntance: if (String.IsNullOrEmpty(userName)) { ModelState.AddModelError("username", "You must specify a username."); } if (!String.Equals(password, confirmPasswo...

Why can I create a new user, but when I immediately attempt to authenticate with their credentials, I fail?

I create a new user, approve them, then immediately attempt to authenticate with the credentials I just used to create the user...and get "false" back the Authenticate method. string username = "me"; string password = "mypassword"; string email = "[email protected]"; Membership.CreateUser(username, password, email); currentUser = Membersh...

Can anonymous and authenticated profiles coexist together in ASP.NET ?

I'm trying to figure out exactly when the event Profile_MigrateAnonymous fires. My best guess from just tracing through my code is that it fires when it detects BOTH an anonymous membership cookie AND an authenticated membership cookie. Can anyone confirm this? I'm looking for real in depth answer here. Not just it gets called 'when a u...

log out asp.net user through sql?

Can I force a log out through SQL for asp.net membership account? ...

What Active Directory field do I use to uniquely identify a user?

I have an Asp.net MVC project authenticating through AD. I would like to store audit information in tables for the current logged in user. What should I be storing in the database? I am currently using SamAccountName for my membership and role providers. Should I be using this? Should I use the more verbose and modern UserPrincipalName? ...

What is the cookie related to /_vti_bin/Discovery.asmx and why can't I set its Secure attribute?

I have a WSS 3.0 site that uses forms authentication. In addition to my authentication cookie I get a cookie that contains data like this: 2FDiscovery=WorkspaceSiteName=aHR0cDovL3d3dy5rZWxldi5iaXo= path=/_vti_bin/Discovery.asmx; This cookie does not have the Secure attribute set, even though I have requireSSL="true" in my web.config ...

Why is the membership API adding an extra record to the aspnet_Applications table?

We are talkign ASP.NET 2.0. I have already added the applicationName attribute to my providers group in the web.config. But still, when I clear out all the tables and run the app, when I add a user, it adds 2 records, one with an ApplicationName= the actual application name I specified, and another with ApplicationName="/". Now, I did n...

asp.net membership - customize password recovery

I want to customize asp:PasswordRecovery control. I am using asp.net membership to control login etc. How do I change "from" email-address on the email that sends the new password? How do I change the content of the email that sends the new password? ...

Use Multiple ASP.NET Role Providers Simultaneously

I'm developing an ASP.NET system that has two different 'tiers' of roles. The main tier will use Active Directory groups to determine membership, while the second tier will use a database. All users will have a tier-1 AD role, but not all users will have a tier-2 database role. I know I can use the AspNetWindowsTokenRoleProvider to mana...

Can you configure .Net membership to use a config/xml file as it's datasource

I'm developing a fairly simple website for a friend and want to provide some admin access features using .Net membership authentication. Is it possible to store the role/user/membership info in the web.config or some other xml file, instead of using a SqlServer database? ...

Asp.Net Forms Authentication browsing to Login page again after a successful Login.

I have my forms authentication system working. I found an odd behavior such that after successful Login; I was asked to Login again, if I browse to Login page from default page. I was assuming that it should redirect me to default page since I am already authenticated. Here's Web.config element I used: <authentication mode="Forms">...

Single script to fully manage .net SQL membership provider data

Hello, 3 Years ago I came across a really nice script. It was just an aspx and aspx.cs script, nothing more. It allowed me to see all the roles and users on site. I could easily add/remove roles and add users to roles. It used ajax for nice ui too. Does anyone know where I can find this script? I would like to use it again because s...

When using ASP.Net Membership plus an additional table to store user Information, should I link other tables to aspnet_Users or my own Table?

Hello, I'm using ASP.Net membership to secure my site and I have a question about how to store extra user information. By googling and reading other questions I think the 3 accepted approaches to storing additional data Profile framework - generally regarded as too restricting Custom Profile provider - a little bigger than I want to ...

Get permission from Authorize Attribute?

I've implemented my own Authorize attribute, and I notice that it queries to check permissions when I use [Authorize]. Is there any way I can get that permission and use it in the current controller that applies the Authorize attribute without having to rewrite and requery the code in the controller? ...