.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Custom Provider with ADAM

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net

Hey guys,

I'm currently working on a Project where I need to use the ActiveDirectoryMembership Provider for Authentication, but at the same time I also need to retain user profile information in the application.

At the same time I also want to specify which users I want to have access to the application, which I was actually hoping that I could do directly from the application itself.

Also, is there anyway to run SQLMembershipProvider and ActiveDirectoryMembershipProvider side by side?


View Complete Post

More Related Resource Links

Custom Control Design-Time SiteMap Provider Error


Greetings - I was referred here by MSDN forums hope this is the right place -  

I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains

Error Creating Control - MyControl  The provider 'AspNetXmlSiteMapProvider' specified for the defaultProvider does not exist in the providers collection.

I have discovered that the error is cause by this line of code:

string div = string.Format("<div class='{0}' id='{1}'>{2}</div>", this.CssClass, this.ID.ToString(), EnumerateNodesRecursive(SiteMap.RootNode, level));

or more specifically, by the reference to SiteMap.RootNode - I am not clear what is missing thoough because I have configured the SiteMapProvider in web.config as this:

        <add name="AspNetXmlSiteMapProvider" 
             type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

Fuzz Testing: Create a Custom Test Interface Provider for Team System


Dan Griffin shows the extensibility of Visual Studio 2005 Team Edition for Software Testers by discussing the modification of the existing Test Interface Provider sample in the latest Visual Studio SDK and implements Fuzz Testing.

Dan Griffin

MSDN Magazine November 2007

ADO.NET: Building a Custom Data Provider for Use with the .NET Data Access Framework


The System.Data.dll assembly in the .NET Framework contains namespaces whose base classes can be used to create custom data providers. These namespaces also define a number of data access interfaces and base classes that let developers create data providers that will interoperate with other custom providers. Using the ADO.NET classes Connection, Command, DataReader, and DataAdapter, writing a provider is easier than writing one for OLE DB. This article explains these classes and their implementation, and how they can be used to write a variety of different kinds of data providers.

Bob Beauchemin

MSDN Magazine December 2001

Implementing a custom Membership Provider vs. using aspnet_Profile table - Which should I do?


I wanted to expand the amount of information that is associated with each user(MembershipUser) in the ASPNETDB.MDF database file. Adding columns like FirstName, LastName, etc. So I began implementing my own custom Membership Provider. I created a derived MembershipUser class with the extra private variables that I wanted each MembershipUser record to store. Its basically done. Almost after I did this I stumbled across the columns in the ASPNETDB.MDF->aspnet_Profile table called "PropertyNames" and "PropertyValuesString".  Could I have simply used these two columns to accomplish what I was attempting to do or are these columns for global application configuration settings?  

Is the aspnet_Profile table purpose to store expanded/related information about users such as personal information? Or is it for something else? Thanks.

Adding additional fields to my custom membership provider

Hi, i have been playing around with the membership provider model for the last week and have it got it working with a basic table schema.  The trouble i have is that i wish to add an additional field (eg First Name) but am not sure how i can do this.  Here's what i have so far: public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)    {        MembershipUser user = new MembershipUser(Name, username, providerUserKey, email, passwordQuestion, null, isApproved, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);        string sql = "INSERT INTO USERS(USERNAME,PASSWORD,EMAIL,ISACTIVE) VALUES(@UID,@PWD,@EMAIL,@ISACTIVE)";        db.AddParameter("@UID", username);        db.AddParameter("@PWD", password);        db.AddParameter("@EMAIL", email);        db.AddParameter("@ISACTIVE", (isApproved == true ? "Y" : "N"));        int i = db.ExecuteNonQuery(sql); 

Custom Role Provider Not Authenticating Users

I have created a custom role provider that is hard coded to say everyone is in a certain group (code below).  I have edited the webconfig of Central Admin, my Web Front End, and the Claims Service.  I can sucessuflly log in using the asp.net membership provider and configured access to the site by adding the "custom" role to the Owner Group.  With all of the above items setup I can launch visual studio and attach the to IIS process and verify that my custom role provider is being called.  Even with all this setup I cannot get another forms based user to be able to access the site.  The other user is getting a sharepoint access denied issues. Any Ideas?   public class IdBasedRoleProvider : RoleProvider { public const string AllAuthenticatedUsersRoleName = "custom"; public override string ApplicationName { get; set; } public override string[] GetRolesForUser(string username) { return new[] { AllAuthenticatedUsersRoleName }; } public override bool RoleExists(string roleName) { if (roleName == AllAuthenticatedUsersRoleName) return true; else return false; } #region Methods Not Implemented public override string[] GetAllRoles() { throw new NotImplementedException(); } public override bool IsUserInRole(string username, string roleName) { throw new NotImplementedException(); } public override void Ad

Custom Membership Provider Problem

Hi there, I'm writing a web app using C# and .NET 2.0 (corporate environment, so I can't use 4.0) and I'm running into an issue with custom membership providers. Everything compiles, and looks like it should work, but I get this error when viewing the WSAT Security tab:  Could not load type 'BinCSF.Security.CUser' from assembly 'App_Code.f4qdas9h, Version=, Culture=neutral, PublicKeyToken=null' <membership> section of web.config: http://illogi.ca/l/snippets/bincsf_web_config.html BinCSF.Security.UserProvider: http://illogi.ca/l/snippets/bincsf_userprovider.html BinCSF.Security.CUser: http://illogi.ca/l/snippets/bincsf_cuser.html Any help would be greatly appreciated.

Sharepoint 2007 Custom Role Provider

I have been trying to configure Sharepoint 2007 to use a custom role provider (using Forms based authentication) that we have developed.  I have been following the tutorial at http://www.andrewconnell.com/blog/articles/HowToConfigPublishingSiteWithDualAuthProvidersAndAnonAccess.aspx, so my configuration files look similar (only database connection string changes).   I have the Membership role provider working (able to add users to my site collection) but am not able to figure out what i have done wrong in setting up the role provider.   To verify that our code works, I setup an empty website project and called the asp.net configuation tool (as described in the above reference article) and am able to view/create/remove/etc... roles as expected, so I think the role provider is working correctly.   What is the recommended way to debug my problem?   Thanks Greg.

Custom membership provider and FormsAuthentication.

Hello folk, I've implemented my custom membership provider. I use third server for authentication (call web method that validates user/password). I need this user/password for retrieve some additional data from this server. Asp.net MVC uses FormsAuthentication and cookie for keep 'login state' by default. It works well when I login on site first time. But when I close and open site again sometime after, cookie keeps it 'login' but I don't have credential for access to server data. I can change cookieless attribute (to 'UseUri' for example) in configure file but in this case I should login again if I open second tab with this app in same browser. My questions: Is way to call SingOut of FormsAuthentication (remove authentication ticket from browser) when user closes asp.net mvc app?Is secure way to pass user/password data through session? Because server is unstable and interrupt connection often and app should have possibility for silent reconnect.

How to write a Custom Membership Provider

Hi guys, Can someone please tell me where to start with creating a custom membership and roles provider? I've found tons of information on how to implement a custom provider but not how to actually create it. I have an Oracle database with a users table. In this table I have a "Platform" column. I would like to authenticate through FBA only the users from this table who have a specific Platform value. Now I know i need to write a custsom membership provider that handles all sorts of requests but i really dont know what to base it on, where to add it in the sharepoint solution etc.   your help will be soooo greatly appreciated!The world is the mollusc of your choice

Web.config for Custom Membership Provider

I am trying to set-up the connection strings to my Membership Provider. I am using the Sql server database and not the default aspnet_db. Iam giving the Fully Qualifying namespace+class in my "type"  and it still throws an error msg "connection string cannot be blank". Web.config: < < < < membership defaultProvider="CustomMembershipProvider">providers>clear />add connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="RavLoginApp" description="Stores and retrieves membership data from the local Microsoft SQL Server database" name="CustomMembershipProvider" type="MyNamespace.CustomMembershipProvider" />  </providers> </membership <connectionStrings > <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="data source=;database=MyLocaldb;uid=xxxxx;pwd=xxxxxx" providerName="System.Data.SqlClient" /> <

Custom membership provider using MYSQLMemberShipr Provider

hi, I am implementing my custom membership provider for MYSQL for this I write thi code: public class CustomSqlMembershipProvider :MySQLMembershipProvider {   public override void Initialize(string name, NameValueCollection configs) { base.Initialize(name, configs); } } When I am compiling this class, getting an error: 'Project.Models.CustomSqlMembershipProvider': cannot derive from sealed type 'MySql.Web.Security.MySQLMembershipProvider' C:\Workarea\\Project\Models\CustomSqlMembershipProvider.cs Why I getting this error. I have added the MySql.web and MySql.Data assembly references thanks in advance Aayushi

Custom IP-STS - The trusted login provider did not supply a token accepted by this farm.

Similar to this thread , I am attempting to setup a Trusted Identity Provider for SharePoint 2010.  I have made it past all the errors in that thread to successfully get a token created with custom claims and have them placed in a token and successfully decrypted on the SharePoint side.  However, SharePoint doesn't like my unencrypted token. I have removed the bearer information from the token on the STS side but that didn't do anything.  I also remove the Microsoft.SharePoint.IdentityModel.SPSaml11SecurityTokenHandler and the SPPassiveIssuerNameRegistry, but still get the same error:   Exception information:     Exception type: FaultException     Exception message: The trusted login provider did not supply a token accepted by this farm.   Request information:     Request URL: http://sharepoint2010:777/_trust/default.aspx     Request path: /_trust/default.aspx     User host address: fe80::f1bd:4865:3597:c845/_trust     User:      Is authenticated: False     Authentication Type:      Thread account name: CONTOSO\administrator   Thread information:     Thread ID: 6     Thread account name: CONTOSO\administrator     Is impersonating: False     Stack trace:    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustClient.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustClient.Issue(RequestS

membership provider with custom login form problem / question

Hi all, I am using the .net membership provider, and I can get past the membership.validate user ok and into my secure page.   The problem I have is that when I reach the secured page, I have a login status control which isn't changing from login to logout.   Below is my login code:If Membership.ValidateUser(txtUsername.Text, txtPassword.Text) Then Response.Redirect("/auth/Default.aspx") If chkRememberMe.Checked Then FormsAuthentication.SetAuthCookie(txtUsername.Text, True) Else FormsAuthentication.SetAuthCookie(txtUsername.Text, False) End If Else lblLoginStatus.Text = "Oops! Login not found!" End If    Thanks in advance.

Custom membership provider not returning values from my web.config


I created a custom membership provider in my ASP.NET 4.0 web site, stored  in App_Code, and referenced in my web.config.

However, it doesn't appear to be pulling values out of web.config during initialization.

The code was taken from http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider, and the only modifications were changing "connectionStringName" here to the name of my connection string:

    Dim ConnectionStringSettings As ConnectionStringSettings = _

The connection string always comes back as nothing in this line:

    If ConnectionStringSettings Is Nothing OrElse ConnectionStringSettings.ConnectionString.Trim() = String.Empty Then
      Throw New ProviderException("Connection string cannot be blank.")
    End If

No matter what I change the password format to in web.config, the default value here is always used:

    Dim temp_format As String = config("passwordFormat")
    If temp_format Is Nothing Then
      temp_format = "Has

custom membership provider with WSS API problem


Hi, I just ran into a weird problem when writing a custom membership provider for a wss site.

This is how we validate user, since the authentication is using webserivce, we need to call the web user and passing user name and password to the webserice then update the WSS Profile based on the webservice call. This is how we do for ValidateUser(string username, string password)

 public override bool ValidateUser(string username, string password)
      edwsusermaintWS.edwsusermaint usermgt_ws = new ASP.NET.CustomMembership.edwsusermaintWS.edwsusermaint();
      bool isvalid = false;

        string userinfo = usermgt_ws.validatePassword(username, password);

        if (userinfo != null && userinfo.Length > 0)
          SPWeb siteEval = null;
              using (SPSite siteCollection = new SPSite(SPContext.GetContext(System.Web.HttpContext.Current).Site.Url))
                SPWeb site = siteCollection.OpenWeb();
                siteEval = site;

            siteEval.AllowUnsafeUpdates = true;
            //This is not efficient process, because everytime, people logs in,it queries the webservice to update
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend