Custom Role Provider: Object not set to an instance...

Last post 10-24-2006 3:52 PM by absnobel. 1 replies.

Sort Posts:

  • Custom Role Provider: Object not set to an instance...

    10-23-2006, 3:38 PM
    • Loading...
    • absnobel
    • Joined on 10-23-2006, 3:33 PM
    • Toronto
    • Posts 2

    I have written a custom role provider for my webapp. I have included proper arguments in my webconfig... however when I navigate to my site i am getting some sorta funny error.

    included: Error Output, Relevant web.config snippet.

    Error:

    Parser Error Message: Object reference not set to an instance of an object.

    Source Error:

    Line 79:         <add
    Line 80: name="myroleprovider"
    Line 81: type="aarons.Mine.MyRoleProvider"
    Line 82: applicationName="MyRoleProvider"
    Line 83: connectionStringName="MySqlConnection"

     Web.config

    <roleManager defaultProvider="myroleprovider"
          enabled="true"
          cacheRolesInCookie="true"
          cookieName=".ASPROLES"
          cookieTimeout="30"
          cookiePath="/"
          cookieRequireSSL="false"
          cookieSlidingExpiration="true"
          cookieProtection="All">
          <providers>
            <clear />
            <add
              name="myroleprovider"
              type="aarons.Mine.MyRoleProvider"
              applicationName="MyRoleProvider"
              connectionStringName="MySqlConnection"
              writeExceptionsToEventLog="false" />
          </providers>
        </roleManager>
        <membership defaultProvider="mymembershipprovider" userIsOnlineTimeWindow="15">
          <providers>
            <clear />
            <add
              name="mymembershipprovider"
              type="MyMembershipProvider"
              connectionStringName="MySqlConnection"
              passwordFormat="Hashed" />
          </providers>
        </membership>

     

    MyRoleProvider.cs - sits inside the app_code dir alongside my membership provider.. when role provider is sert to false everything works smoothly.

    namespace aarons.Mine
    {
    public sealed class MyRoleProvider : RoleProvider

        private string eventSource = "MyRoleProvider"; //Application Name
        private string eventLog = "Application"; //Log Title
        private string exceptionMessage = "An exception occurred. Please check the Event Log."; //General Exception msg
        private ConnectionStringSettings pConnectionStringSettings; //The connection String settings
        private string connectionString;//self explanatory
        private bool pWriteExceptionsToEventLog = false;
        public bool WriteExceptionsToEventLog

    **************************************************************

    That should be enough info to help me out. If not I will add more as needed. Dont know why im getting such an error! grr :Confused:

     

    Sincerest,

    Aaron 

    "This lion is not a cub anymore..I've got a full grown mane. :RAWWWWWR!:" - me
  • Re: Custom Role Provider: Object not set to an instance...

    10-24-2006, 3:52 PM
    Answer
    • Loading...
    • absnobel
    • Joined on 10-23-2006, 3:33 PM
    • Toronto
    • Posts 2

    The Problem has been solved it was due to a configurationmanager not accessing the webconfig correctly... had to figure this out since im running on a shared server with limited access the only way i was able to solve this riddle was by copying the website locally and then running the .net server locally under debug. grr for aspnets most ambiguous error messages!

     

    Aaron

    "This lion is not a cub anymore..I've got a full grown mane. :RAWWWWWR!:" - me
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter