Problems with WebConfig?

Hi Experts, I apologize if this turns out to be a dumb question, but I have been building a app for a customer and everything was working fine. Finally I got to point where I was going to add the formsauthentication and a asp:Login control. Having done this many times before, it only took a few minutes. However it had an odd affect and I cannot seem to pin down the problem. Whenever I login and am authenticated, it displays a menu system to navigate through an administrative area, but on clicking on any link, when the appropriate page displays I recieve the following message:
Object reference not set to an instance of an object.

This never happened prior to the addition of the Webconfig which is located in the same folder as the admin files.

So as a test I excluded thhis web config and tried with the same results. So I expect that it may be in the main webconfig, but cannot imagine what would cause this.

If anyone has any pointers, it would be very much appreciated.
CJSantoraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
It might help if you have a line of code, or a full stack trace for the exception.

Bob
0
CJSantoraAuthor Commented:
Sorry I an provide either, I am just not sure what to show you. I have done some additional testing and it appears that any page that loads with a control on it fails, One page has a dropdownlist and fails with the message stated above and another has a grid and yet another a label. I will post the webconfig, but I am not sure what the reason is. I am posting the websconfig which is located in the main site, since I have excluded the one in the admin section and still have the same problem.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <configSections>
    <section name="MemberApp" type="AF.MemberApp.ConfigurationSection, __code"/>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD3RTETE64E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AERTERTD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <MemberApp defaultConnectionStringName="LocalSqlServer">
    <contactForm mailTo="info@DOMAIN.com"/>
    <store sandboxMode="true" businessEmail="info@DOMAIN.COM"/>
  </MemberApp>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=SOME IP;Initial Catalog=USER;User Id=cust1810-1;Password=PASSWORD;"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <pages theme="General" masterPageFile="~/memberapp.master" maintainScrollPositionOnPostBack="true">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>
    <!-- This allows a image size of 1 GB to be uploaded -->
    <httpRuntime maxRequestLength="1048576" executionTimeout="3600"/>
    <trace enabled="true" pageOutput="true"/>
    <authentication mode="Forms">
      <forms name="AFFORMAUTH" loginUrl="~/Login.aspx" cookieless="AutoDetect"/>
    </authentication>
    <!--
      Possible modes are "transitional", "strict", and "legacy".
      <xhtmlConformance mode="transitional" />
      -->
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF38SDF56AD364E35" validate="false"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856SADFAD364E35"/>
    </httpHandlers>
    <httpModules>
      <add name="WebChartImageStream" type="blong.WebControls.WebChartImageStream, blong"/>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF385SADF6AD364E35"/>
    </httpModules>
    <membership>
      <providers>
        <remove name="AspNetSqlMembershipProvider"/>
        <add name="AspNetSqlMembershipProvider" connectionStringName="LocalSqlServer" applicationName="/" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </membership>
    <siteMap defaultProvider="AF_SiteMapProvider" enabled="true">
      <providers>
        <add name="AF_SiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true" siteMapFile="web.sitemap"/>
      </providers>
    </siteMap>
    <sessionState cookieless="AutoDetect"/>
    <roleManager enabled="true" cacheRolesInCookie="true" cookieName="AFROLES" defaultProvider="AF_RoleProvider">
      <providers>
        <add connectionStringName="LocalSqlServer" applicationName="/" name="AF_RoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </roleManager>
    <anonymousIdentification cookieless="AutoDetect" enabled="true"/>
    <profile defaultProvider="AF_ProfileProvider">
      <providers>
        <add name="AF_ProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
      <properties>
        <add name="Newsletter" type="String"/>
        <add name="FirstName" type="String"/>
        <add name="LastName" type="String"/>
        <add name="Gender" type="String"/>
        <add name="BirthDate" type="DateTime"/>
        <add name="Occupation" type="String"/>
        <add name="Website" type="String"/>
        <group name="Address">
          <add name="Street1" type="String"/>
          <add name="Street2" type="String"/>
          <add name="City" type="String"/>
          <add name="State" type="String"/>
          <add name="PostalCode" type="String"/>
          <add name="Country" type="String"/>
        </group>
        <group name="Contacts">
          <add name="PhoneAreaCode" type="String"/>
          <add name="Phone" type="String"/>
          <add name="MobileAreaCode" type="String"/>
          <add name="Mobile" type="String"/>
          <add name="FaxAreaCode" type="String"/>
          <add name="Fax" type="String"/>
        </group>
        <group name="Preferences">
          <add name="Theme" type="String" allowAnonymous="true"/>
          <add name="Culture" type="String" defaultValue="en-US"/>
        </group>
      </properties>
    </profile>
    <machineKey validationKey="287C5D125D6B7E722ASDFASDFASDFASDFASDFASDFASDF3E1F719E3D58D17BB967703017E1BBE28618FAC6C4501E910C7E59800B5D4C2EDD5B0ED98874A3E952D60BAF260D9D374A74C76CB741803" decryptionKey="5C1D8BD9DF3E1B4E1D01132F234266616E0D5EF772FE80AB" validation="SHA1"/>
    <customErrors defaultRedirect="~/Error.aspx">
      <error statusCode="404" redirect="~/Errors/Error.aspx?code=404"/>
      <error statusCode="408" redirect="~/Errors/Error.aspx?code=408"/>
      <error statusCode="505" redirect="~/Errors/Error.aspx?code=505"/>
    </customErrors>
    <healthMonitoring heartbeatInterval="10800">
      <providers>
        <remove name="SqlWebEventProvider"/>
        <add name="SqlWebEventProvider" connectionStringName="LocalSqlServer" buffer="false" bufferMode="Notification" maxEventDetailsLength="1073741823" type="System.Web.Management.SqlWebEventProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
      <rules>
        <clear/>
        <add name="All Errors" eventName="All Errors" provider="SqlWebEventProvider" profile="Critical"/>
        <add name="Failure Audits" eventName="Failure Audits" provider="SqlWebEventProvider" profile="Critical"/>
        <add name="Heartbeats" eventName="Heartbeats" provider="SqlWebEventProvider" profile="Critical"/>
      </rules>
    </healthMonitoring>
  </system.web>
  <appSettings>
    <add key="mailserver" value="nospam3.accu-find.com"/>
    <add key="registrationFromAddress" value="registration@accufind.com"/>
  </appSettings>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule"/>
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
  </system.webServer>
  <location path="~/Admin/EditProfile.aspx">
    <system.web>
      <authorization>
        <allow roles="Administrator"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="PickupDirectoryFromIis" from="support@DOMAIN.com">
        <network host="MAIL.DOMAIN.com" password="" userName=""/>
      </smtp>
    </mailSettings>
  </system.net>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Open in new window

0
Bob LearnedCommented:
Nope, the web.config won't really help in this case, without understand the nature of the exception.

Bob
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

CJSantoraAuthor Commented:
Sorry Bob, I was not sure if that would help or not. But what can I give you to hep? there is a master file, and many aspx files, but I am not sure what I can give you. I ran a trace on one of the pages and am including the trace below, I appreciate your attempt to help.
aspx.page Begin PreInit   
aspx.page End PreInit 0.000182689587224093 0.000183 
aspx.page Begin Init 0.000209085775627546 0.000026 
aspx.page End Init 0.000590556593091481 0.000381 
aspx.page Begin InitComplete 0.00061391056276929 0.000023 
aspx.page End InitComplete 0.000635931944178933 0.000022 
aspx.page Begin PreLoad 0.000656591032748555 0.000021 
aspx.page End PreLoad 0.000677112774436422 0.000021 
aspx.page Begin Load 0.000697821860800259 0.000021 
Unhandled Execution Error 
Object reference not set to an instance of an object.
  at AF.MemberApp.Calendar.bindMonthsData() in c:\Documents and Settings\carmen\My Documents\Visual Studio 2008\Projects\Websites\domain\Admin\Calendar.aspx.cs:line 44
  at AF.MemberApp.Calendar.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\carmen\My Documents\Visual Studio 2008\Projects\Websites\domain\Admin\Calendar.aspx.cs:line 28
  at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
  at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
  at System.Web.UI.Control.OnLoad(EventArgs e)
  at AF.MemberApp.BasePage.OnLoad(EventArgs e) in c:\Documents and Settings\carmen\My Documents\Visual Studio 2008\Projects\Websites\domain\App_Code\Base\BasePage.cs:line 62
  at System.Web.UI.Control.LoadRecursive()
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Open in new window

0
Bob LearnedCommented:
What does AF.MemberApp.Calendar.bindMonthsData look like (line 44)?

Bob
0
CJSantoraAuthor Commented:
       private void bindMonthsData()
        {
            int month = calTraining.TodaysDate.Month;   //   LINE 44

            string rowfilter = "Discontinued=0";
            string sort = "";
            DataView dv = new DataView(Classes.GetClassesByMonth(month), rowfilter, sort, DataViewRowState.CurrentRows);

            pnlDetails.Visible = true;            
            rpDetails.DataSource = dv;
            rpDetails.DataBind();
        }
0
CJSantoraAuthor Commented:
But this happens on every page with a control, Label, Calender, Grid and started happening when I applied the login page.
0
Bob LearnedCommented:
If you are using today's date, then why don't you just do this:

    int month = DateTime.Now.Month;

Bob
0
CJSantoraAuthor Commented:
The date is pulled from the calendar based on the user selection. But the real problem is that the controls will not load. It is like the application will not load the controls or do not have access to them.
0
Bob LearnedCommented:
TodaysDate doesn't return the selected date, that would be SelectedDate -- TodaysDate = DateTime.Now.

Is this a normal asp:Calendar control?

Bob
0
CJSantoraAuthor Commented:
I will change the code. Yes this is a asp:Calendar. Is there something that would cause a .NET page to not load a .Net control? I even made sure I could load other applications to rule out the possibility of a corrupt assembly in .Net.
0
Bob LearnedCommented:
There is a call to Control.LoadRecursive, so it should be loading all the controls, and I can't think of anything right now that would affect that.

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CJSantoraAuthor Commented:
A break! On the master page I had used a asp:Login control and all the links to the subsequest pages were in the LoggedInTemplate, so that they became available once your had authenticated. I took them out of this part of the control and tested the application again and all pages are working properly. So I guess the asp:Login control was controlling access somehow and not allowing the controls to load. I guess I will put them in a panel and control access by using the visible attribute. any better suggestions or advice would still be appreciated, as was all your time.
0
CJSantoraAuthor Commented:
I appreciate all your help in finding a solution to this problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.