Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6152909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:00:05+00:00 2026-05-23T20:00:05+00:00

I have been writing a small web application in C# .NET4.0 to try and

  • 0

I have been writing a small web application in C# .NET4.0 to try and learn about it and get used to writing applications with it.

My application is very simple; it has a home page, a login button which takes you to the login form, and when you login you can go to an admin page.

The entire login process is done through the .NET login controls, and my database was created using the Aspnet_regsql.exe command through the visual studio command prompt (2010).

I had only been building and testing on my local machine up until now, and now want to try and test on a server with IIS7.

I have setup the site correctly in IIS7, and I can build and upload the site without any problems – that is – until I try to login.
The version of SQL I was using on my local machine is 2008 R2, whereas the version of SQL on the server is plain 2008.
Because of this, I couldn’t just backup my local database and restore it to SQL on the server, so I generated scripts instead and used those scripts to create the database on the server.

Now, when I try to login to the site which is on the server, I get the following error:

Format of the initialization string does not conform to specification starting at index 0.

After trying to look around the internet for a solution I found that it could have just been a problem with my connection strings, so I tried changing them to all sorts of different things with no success.

My application in visual studio is a solution with 3 projects; a DAL, BLL and the Application itself.

I looked for all of the connection strings I could find in the whole solution, and these are the strings I have right now:

DAL (app.config)
(This has changed now – please see ‘EDIT 2’ at the bottom of the question)

<add name="DAL.Properties.Settings.APPNAMEConnectionString"
   connectionString="Data Source=localhost;Initial Catalog=(DATABASE NAME);uid=(USER ID);pwd=(PASSWORD)"
   providerName="System.Data.SqlClient" />

Application (web.config)
(This has changed now – please see ‘EDIT 2’ at the bottom of the question)

<add name="LocalSqlServer" connectionString="server=localhost;database=(DATABASE NAME);uid=(USER ID);pwd=(PASSWORD)"/>

This is the first time I have ever tried to put a C# .NET 4.0 application onto a server, so I really have no idea what I am doing wrong.

Any help would be greatly appreciated!

EDIT 1:

At the request of Dan F here is the membership code I could find in my web.config file:

    <membership>
        <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="LocalSqlServer"
            applicationName="/APPNAME"
            enablePasswordRetrieval="false"
            enablePasswordReset="true"
            requiresQuestionAndAnswer="false"
            requiresUniqueEmail="true"
            passwordFormat="Hashed"
            maxInvalidPasswordAttempts="5"
            minRequiredPasswordLength="5"
            minRequiredNonalphanumericCharacters="0"
            passwordAttemptWindow="10"
            passwordStrengthRegularExpression=""/>
        </providers>
    </membership>
    <profile>
        <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/APPNAME" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
    </profile>
    <roleManager enabled="true">
        <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/APPNAME" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            <add name="AspNetWindowsTokenRoleProvider" applicationName="/APPNAME" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
    </roleManager>

EDIT 2:
I just tested using the DAL to get out a list of users from the membership table that aspnet_regsql.exe generates and it worked fine. So I copied over the connection string from the DAL app.config to the application web.config so that they are exactly the same, but I still get errors when trying to login.

I also decided to try and use the Membership.GetUser() function in the code behind just to see if it would work, and it comes up with the same initialization string error for that too.

Just for reference my connection string in both the app.config and web.config is now:

Data Source=.;Initial Catalog=(DATABASE);User Id=(USERID);Password=(PASSWORD);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:00:07+00:00Added an answer on May 23, 2026 at 8:00 pm

    Well, I finally found my problem.
    In order to save time trying to sort out the cs files from the aspx files and all of the other files which you don’t actually need to upload for a .NET application, I have been using the ‘Build Deployment Package’ button which you can see when you right click on your project in the Solution explorer.

    Being new to .NET and Visual Studio I didn’t realise that this was actually changing my web.config file.

    I thought everything was fine because the web.config file that I was editing (the one which wasn’t generated in the deployment package) had the correct connection string of:

    Data Source=.;Initial Catalog=(DATABASE);User Id=(USERID);Password=(PASSWORD);
    

    But the connection string in the web.config which I was uploading (the one in the deployment package) had been changed to:

    $(ReplacableToken_test-Web.config Connection String_0)
    

    I changed this to the correct connection string and now it is working as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been writing PHP web applications for some time, and have come across very
I've been writing PHP for about six years now and have got to a
I've been given the task of writing a small application to help migrate over
I've been working writing fairly small applications and doing some maintenance work for some
I had been writing number of small libraries (bunch of classes) for my application
For the last couple of months I have been writing an intranet site for
I understand object oriented programming, and have been writing OO programs for a long
I have been thinking of maybe writing a little tool that logs into SO
I have just been getting into low level programming (reading/writing to memory that sort
I have an application dependent on some internal web services, and so we want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.