Setting Up New SQL Connection / web.config file

Discussion in 'Databases' started by mreade, Jan 26, 2011.

  1. I will start out by saying I am "totally new" to SQL databases and I need some assistance with setting up ".config" files and connecting to a database via a sub-domain address.

    Lets start by saying that I have been able to set up a subdomain called: ""

    I have created a subfolder in my web space called "acen" where I have uploaded the folders, aspx files, and .config files that work with the SQL database, lets call "database1."

    I think I have successfully uploaded the "database1" database to the Winhost SQL Server and I have been able to successfully BACKUP and RESTORE database1. So, although I am not 100% sure, I think I am getting close for this being true.

    Here is a snippet of code from my "web.config" file which is located in the subfolder called "acen."

    <add key="sql_connectionstring" value="Server=.\SQLServer;Data; Initial Catalog=database1; User ID=database1_user; Password=**********; Integrated Security=False" />
    <add key="sql_database_name" value="database1" />
    <add key="acen_version_number" value="2.20.00" />
    <add key="acen_version" value="full" />
    <globalization culture="en-GB" uiCulture="en-GB"/>

    <customErrors mode="Off"/>

    <authentication mode="Forms">
    <forms name="acen2Cookie" loginUrl="/ACEN/login.aspx" protection="All" slidingExpiration="false" enableCrossAppRedirects="false" path="/"/>

    <pages buffer="true" enableSessionState="true" enableViewState="true" enableViewStateMac="true" autoEventWireup="true" validateRequest="true"/>
    <machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1"/>

    Most of this was already included in the config file as an example, which was included as part of the database web application.

    So, once the correct changes have been made to the web.config file, here is what I would like to do.

    When users type" in their browsers, I would like for the "login.aspx" page in the ACEN subfolder to connect to the "database1" SQL database on the Winhost servers and display the login page so users can sign in.

    Hopefully, i have explained this the best I can. If this is unclear, please let me know and I will do my best to clarify anything.

    Thanks in Advance.

    Last edited by a moderator: Oct 14, 2015
  2. Ray


    Last edited by a moderator: Oct 14, 2015
  3. When I received the aspx files, I also received scripts already prepared to create users and roles. I have been using this same database on another hosting service.

    I notice in the MDF there are roles already setup.

    Do I need to set up a new database role for the same Database User as it is displayed on the Winhost MS SQL 2008 Manage page where it shows all the data for database name, server, user, password, quota, etc.?

    So, I am wondering why I would need to add more memberships and roles??
    Last edited by a moderator: Oct 14, 2015
  4. Ray


    If you already have the membership/roles schema setup in the database then no you do not need to create the roles. I kind of misunderstood your first thread, I had the assumption you were still trying to setup the membership/roles provider.

    Try this. To make your login page be the startup page, first open Visual Studio 2010 or Visual Web Developer 2010. Navigate to your site and open it. On the right hand side you should see the Solution Explorer tree. If you don't see it go to View/Solution Explorer. Go to the top of your Solution Explorer right click on it and go to Properties Page. Click on Start Options and click on Specific Page and navigate to the specified page you want your site to start on.
  5. Ok, I understand you about he membership/roles. They are already created. However, I am not sure we are on the same page.

    The aspx pages I received when I purchased the database were in a "precomplied version." They already have it setup so the login.aspx is the first page to display.

    It just seems that I cannot get the right web.config changes to work. Like I say, the database is working properly on another hosting service and I did receive a copy of the web.config file used on that hosting service.

    I was trying to modify it so everything will work on Winhost and this is where I am having the problem.

    I have not switched DNS info yet before I try everything and make sure it will run on Winhost first.


    Last edited by a moderator: Oct 14, 2015
  6. Ray


    When you first downloaded the web application it should have given you all the files (web pages) and it would have place it some where in your computer. Try using Visual Studio as I suggested see if you can find it on your computer and open it with Visual Studio. If you are able to run the steps I outlined, you should be able to recompile it and reupload it to our web server. Then the setting you set on Visual Studio to dictate the startup page should be in the new site you uploaded.
  7. This is the error message when I try to run the login.aspx from the following URL:

    Server Error in '/' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error:

    Line 12: <customErrors mode="Off"/>
    Line 13:
    Line 14: <authentication mode="Forms">
    Line 15: <forms name="acen2Cookie" loginUrl="mydomain.yourdomaincom/ACEN/login.aspx:80" protection="All" slidingExpiration="false" enableCrossAppRedirects="false" path="/"/>
    Line 16: </authentication>

    Source File: E:\web\mydomain\acen\web.config Line: 14

    Show Additional Configuration Errors:
    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4209

    Does this help any?

    But the web application I purchased came as precompiled and I cannot recompile it again.
  8. Ray


    Last edited by a moderator: Oct 14, 2015
  9. Thanks Ray for the info. I will set the ACEN folder as an Application Starting Point then see what happens.

    Appreciate all you time on this.
  10. Ray,

    With your suggestion to set the ACEN folder as an "Application Starting Point," I have been able to successfully launch the login.aspx page which is located in the ACEN folder by using the secondary web url. That further connects to my SQL database and I am able to log into the database as the administrator and make changes, additions, etc.

    So with this, I would like to thank you for ALL your help troubleshooting this with me. This has been a new experience for me as when I started this process I had NO experience with SQL database handling, let alone getting this to a server and being able to access same.

    Solution solved!

    Thanks for the great support!!


Share This Page