Need help with ASP.NET website administration tool! - Can't connect to the database when clicked on

Discussion in 'ASP .Net Security' started by Learner, Mar 6, 2006.

  1. Learner

    Learner Guest

    Hello,
    I am just trying to get some familiartity with ASP.NET website
    Administration Tool and set up few users and roles. I launched the tool


    and clicked on provider configuration link and it goes to the page that



    has the link "Select a single provider for all site management data "
    and then I clicke on it and it takes me to the page that has
    AspNetSqlProvider radio button checked. I clicked on the link, test to
    test the connection but its taking long to connect and finally it
    couldn't connect to the database. I am not sure what credentials its
    using to connect to the database.
    This is the link I just copy and pasted thinking it might give any
    inside of it.
    http://localhost:1472/asp.netwebadminfiles/providers/ManageConsolidat...



    When I used windows authentication to connect to the Managment Studio I



    had no problem connecting to it. But I am not sure if the above process



    trying to connect to the SQL Express by default. If it was then it
    makes it sense. Becauase I have deleted SQL Express on my machine
    before installing Sql Server 2005 Developer Edition.


    If thats the case how do I can connect to the SQL Server 2005 from
    the tool? Do I need to setup any think on my machine to have it
    connected to the SQL Server 2005?



    This is the error its throwing after a little while try connecting to
    the databse


    *****************************************************
    Internet Explorer cannot display the webpage


    Most likely causes:
    You are not connected to the Internet.
    The website is encountering problems.
    There might be a typing error in the address.


    What you can try:
    Check your Internet connection. Try visiting another website to make

    sure you are connected.
    Retype the address.
    Go back to the previous page.
    More information
    This problem can be caused by a variety of issues, including:


    Internet connectivity has been lost.
    The website is temporarily unavailable.
    The Domain Name Server is not reachable.
    The Domain Name Server does not have a listing for the website's
    domain.
    If this is an HTTPS (secure) address, click tools, click Internet
    Options, click Advanced, and check to be sure the SSL and TLS protocols

    are enabled under the security section.


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


    Any input is greatly appriciated.
    Thanks
    -L
     
    Learner, Mar 6, 2006
    #1
    1. Advertising

  2. Hi,

    all SQL providers use a connection called "LocalSqlServer" which points to
    a local SQL Sever Express User Instance. You can find this string in machine.config.

    You have to change either the connection string, or the provider config to
    use a different connection string.

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hello,
    > I am just trying to get some familiartity with ASP.NET website
    > Administration Tool and set up few users and roles. I launched the
    > tool
    > and clicked on provider configuration link and it goes to the page
    > that
    >
    > has the link "Select a single provider for all site management data "
    > and then I clicke on it and it takes me to the page that has
    > AspNetSqlProvider radio button checked. I clicked on the link, test to
    > test the connection but its taking long to connect and finally it
    > couldn't connect to the database. I am not sure what credentials its
    > using to connect to the database.
    > This is the link I just copy and pasted thinking it might give any
    > inside of it.
    > http://localhost:1472/asp.netwebadminfiles/providers/ManageConsolidat.
    > ..
    > When I used windows authentication to connect to the Managment Studio
    > I
    >
    > had no problem connecting to it. But I am not sure if the above
    > process
    >
    > trying to connect to the SQL Express by default. If it was then it
    > makes it sense. Becauase I have deleted SQL Express on my machine
    > before installing Sql Server 2005 Developer Edition.
    >
    > If thats the case how do I can connect to the SQL Server 2005 from the
    > tool? Do I need to setup any think on my machine to have it connected
    > to the SQL Server 2005?
    >
    > This is the error its throwing after a little while try connecting to
    > the databse
    >
    > ***************************************************** Internet
    > Explorer cannot display the webpage
    >
    > Most likely causes:
    > You are not connected to the Internet.
    > The website is encountering problems.
    > There might be a typing error in the address.
    > What you can try:
    > Check your Internet connection. Try visiting another website to
    > make
    > sure you are connected.
    > Retype the address.
    > Go back to the previous page.
    > More information
    > This problem can be caused by a variety of issues, including:
    > Internet connectivity has been lost.
    > The website is temporarily unavailable.
    > The Domain Name Server is not reachable.
    > The Domain Name Server does not have a listing for the website's
    > domain.
    > If this is an HTTPS (secure) address, click tools, click Internet
    > Options, click Advanced, and check to be sure the SSL and TLS
    > protocols
    > are enabled under the security section.
    >
    > *****************************************************
    >
    > Any input is greatly appriciated. Thanks -L
    >
     
    Dominick Baier [DevelopMentor], Mar 6, 2006
    #2
    1. Advertising

  3. Learner

    Learner Guest

    Hello Dominick,
    Thanks for the quick reply. I have done as you directed but no luck
    yet and a I am not sure if I have done it right.
    Here is the ConnectionStrings code from the machine.config file
    *********************************************************************
    <connectionStrings>
    <!--<add name="LocalSqlServer" connectionString="data
    source=.\SQLEXPRESS;Integrated
    Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    Instance=true" providerName="System.Data.SqlClient" />-->


    <add name="LocalSqlServer" connectionString="data
    source=.\DEV\SQLDM2005;Integrated
    Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    Instance=true" providerName="System.Data.SqlClient" />
    </connectionStrings>
    ********************************************************************
    In the above code I have commented out the original line of connection
    string as you see and copy pasted the same line and changed the
    datasource paramater to , data source=.\DEV\SQLDM2005 but I got the
    same message as in my first post. DEV\SQLDM2005 is SQL Server 2005 and
    DEV is our SQL Server 2000 so I tried using both the servers but no
    luck.

    Have I done it right in the machine.config file? And I am not familiar
    how do I it in the provider config file either.

    Please help.
    Thanks
    -L
     
    Learner, Mar 7, 2006
    #3
  4. Hi,

    you have to remove the .\ at the beginning of the datasource name - and some
    other junk

    have you used the aspnet_regsql tool to create the database in sql server??
    if not do it now :)

    <add

    name="LocalSqlServer"
    connectionString="data source=DEV\SQLDM2005;initial catalog=aspnetdb;Integrated
    Security=SSPI"
    providerName="System.Data.SqlClient" />


    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hello Dominick,
    > Thanks for the quick reply. I have done as you directed but no luck
    > yet and a I am not sure if I have done it right.
    > Here is the ConnectionStrings code from the machine.config file
    > *********************************************************************
    > <connectionStrings>
    > <!--<add name="LocalSqlServer" connectionString="data
    > source=.\SQLEXPRESS;Integrated
    > Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    > Instance=true" providerName="System.Data.SqlClient" />-->
    >
    > <add name="LocalSqlServer" connectionString="data
    > source=.\DEV\SQLDM2005;Integrated
    > Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    > Instance=true" providerName="System.Data.SqlClient" />
    > </connectionStrings>
    > ********************************************************************
    > In the above code I have commented out the original line of connection
    > string as you see and copy pasted the same line and changed the
    > datasource paramater to , data source=.\DEV\SQLDM2005 but I got the
    > same message as in my first post. DEV\SQLDM2005 is SQL Server 2005 and
    > DEV is our SQL Server 2000 so I tried using both the servers but no
    > luck.
    >
    > Have I done it right in the machine.config file? And I am not familiar
    > how do I it in the provider config file either.
    >
    > Please help.
    > Thanks
    > -
     
    Dominick Baier [DevelopMentor], Mar 7, 2006
    #4
  5. Learner

    Learner Guest

    Dominick,
    Just now I have made a little change to the connection string

    <add name="LocalSqlServer" connectionString="data
    source=.\DEV\SQLDM2005;Integrated
    Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    Instance=true" providerName="System.Data.SqlClient" />

    I changed data source=.\DEV\SQLDM2005 to data source=DEV\SQLDM2005
    (just took out ".\" from data source value but not sure if I can do it
    but just wanted to give it a try) and this time I got a different
    message


    "Could not establish a connection to the database.
    If you have not yet created the SQL Server database, exit the Web Site
    Administration tool, use the aspnet_regsql command-line utility to
    create and configure the database, and then return to this tool to set
    the provider. "

    And also as I am trying to connect to my SQL Server 2005 developer
    edition I also did try taking off the below parameter and its value

    "AttachDBFilename=|DataDirectory|aspnetdb.mdf;"

    but it still convey the same message as above.

    Any inputs on this too?

    Thank you.
    -L
     
    Learner, Mar 7, 2006
    #5
  6. Learner

    Learner Guest

    Cool!!! I got it :)

    the below connection string worked finally.

    <add name="LocalSqlServer" connectionString="data
    source=DEV\SQLDM2005;Integrated Security=SSPI;initial catalog=aspnetdb"
    providerName="System.Data.SqlClient" />

    But I am not sure why it didn't work when it had "User Instance=true"
    attribute in it. Is there a reason why it behaves differently when it
    contains this attribute?

    Thank you for the help.

    -L
     
    Learner, Mar 7, 2006
    #6
  7. Learner

    Learner Guest

    Hello Dominick,
    I have a question regarding the web.config file in my project and
    machine.config file.

    Just to test I just copied the entire <connectionStrings> tag code
    snippet from the machine config filie and pasted in the local
    web.config file in my webproject and changed the connectionstring
    attribute and when I went to the website/ASP.NET configuaration I
    doesn't display the page and its throwing the page can't be displayed
    error! It doesn't look like it recognises the local changes. But at the
    same time I am not sure if I have done it right. When I comment this in
    my local web.config file and put the changes in the machine.config and
    it works fine. I am doing it right here? please suggest.

    the below code is in my web.config file...
    <connectionStrings>
    <clear />
    <add name="LocalSqlServer" connectionString="data
    source=DEVI\SQLDM2005;Integrated Security=SSPI;initial
    catalog=aspnetdb" providerName="System.Data.SqlClient" />
    </connectionStrings>


    Thanks
    -L
     
    Learner, Mar 7, 2006
    #7
  8. hi,

    putting this snippet in your local web.config will overwrite the machine.config
    connection string.

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hello Dominick,
    > I have a question regarding the web.config file in my project and
    > machine.config file.
    > Just to test I just copied the entire <connectionStrings> tag code
    > snippet from the machine config filie and pasted in the local
    > web.config file in my webproject and changed the connectionstring
    > attribute and when I went to the website/ASP.NET configuaration I
    > doesn't display the page and its throwing the page can't be displayed
    > error! It doesn't look like it recognises the local changes. But at
    > the same time I am not sure if I have done it right. When I comment
    > this in my local web.config file and put the changes in the
    > machine.config and it works fine. I am doing it right here? please
    > suggest.
    >
    > the below code is in my web.config file...
    > <connectionStrings>
    > <clear />
    > <add name="LocalSqlServer" connectionString="data
    > source=DEVI\SQLDM2005;Integrated Security=SSPI;initial
    > catalog=aspnetdb" providerName="System.Data.SqlClient" />
    > </connectionStrings>
    > Thanks
    > -L
     
    Dominick Baier [DevelopMentor], Mar 7, 2006
    #8
  9. sorry - yes - this is the recommended way.

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hello Dominick,
    > I have a question regarding the web.config file in my project and
    > machine.config file.
    > Just to test I just copied the entire <connectionStrings> tag code
    > snippet from the machine config filie and pasted in the local
    > web.config file in my webproject and changed the connectionstring
    > attribute and when I went to the website/ASP.NET configuaration I
    > doesn't display the page and its throwing the page can't be displayed
    > error! It doesn't look like it recognises the local changes. But at
    > the same time I am not sure if I have done it right. When I comment
    > this in my local web.config file and put the changes in the
    > machine.config and it works fine. I am doing it right here? please
    > suggest.
    >
    > the below code is in my web.config file...
    > <connectionStrings>
    > <clear />
    > <add name="LocalSqlServer" connectionString="data
    > source=DEVI\SQLDM2005;Integrated Security=SSPI;initial
    > catalog=aspnetdb" providerName="System.Data.SqlClient" />
    > </connectionStrings>
    > Thanks
    > -L
     
    Dominick Baier [DevelopMentor], Mar 7, 2006
    #9
  10. Learner

    Learner Guest

    Dominick,
    I am not sure if you udnerstood my previous post right. I said that
    It doesn't work when I copy pasted the <connecetionString> attribute in
    my web.config file. Here it is...
    <configuation>
    <connectionStrings>
    <clear />
    <add name="LocalSqlServer" connectionString="data
    source=DEVI\SQLDM2005;Integrated Security=SSPI;initial
    catalog=aspnetdb" providerName="System.Data.SqlClient" />
    </connectionStrings>
    </configuration>


    And the <connectionString> code in the achine.config is as below...

    <connectionStrings>
    <add name="LocalSqlServer" connectionString="data
    source=.\SQLEXPRESS;Integrated
    Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    Instance=true" providerName="System.Data.SqlClient" />

    <!--add name="LocalSqlServer"
    connectionString="data source=DEV\SQLDM2005;initial
    catalog=aspnetdb;Integrated
    Security=SSPI"
    providerName="System.Data.SqlClient" />-->

    </connectionStrings>

    As you clearly see I have commented out the changed connectionstring in
    the machine.config file. And the <connectionString> code in my
    web.config file as you see on the top, to my understanding should
    override the settings in machine.config file. But when I have these
    things set up as is it doesn't work. I mean in other words it is not
    recongnising the changes in my local web.config file.

    Please suggest me how do I do it here.

    Thanks
    -L
     
    Learner, Mar 7, 2006
    #10
  11. Hi,

    as i said - the local web.config overrides machine.config - there must be
    something different wrong

    try a

    Response.Write(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);

    and see which connection string your application can "see".

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Dominick,
    > I am not sure if you udnerstood my previous post right. I said that
    > It doesn't work when I copy pasted the <connecetionString> attribute
    > in
    > my web.config file. Here it is...
    > <configuation>
    > <connectionStrings>
    > <clear />
    > <add name="LocalSqlServer" connectionString="data
    > source=DEVI\SQLDM2005;Integrated Security=SSPI;initial
    > catalog=aspnetdb" providerName="System.Data.SqlClient" />
    > </connectionStrings>
    > </configuration>
    > And the <connectionString> code in the achine.config is as below...
    >
    > <connectionStrings>
    > <add name="LocalSqlServer" connectionString="data
    > source=.\SQLEXPRESS;Integrated
    > Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
    > Instance=true" providerName="System.Data.SqlClient" />
    >
    > <!--add name="LocalSqlServer"
    > connectionString="data source=DEV\SQLDM2005;initial
    > catalog=aspnetdb;Integrated
    > Security=SSPI"
    > providerName="System.Data.SqlClient" />-->
    > </connectionStrings>
    >
    > As you clearly see I have commented out the changed connectionstring
    > in the machine.config file. And the <connectionString> code in my
    > web.config file as you see on the top, to my understanding should
    > override the settings in machine.config file. But when I have these
    > things set up as is it doesn't work. I mean in other words it is not
    > recongnising the changes in my local web.config file.
    >
    > Please suggest me how do I do it here.
    >
    > Thanks
    > -L
     
    Dominick Baier [DevelopMentor], Mar 7, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. keithb
    Replies:
    2
    Views:
    6,934
    Gideonr1
    Dec 11, 2007
  2. Replies:
    1
    Views:
    467
    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=
    Apr 11, 2006
  3. John
    Replies:
    4
    Views:
    4,284
    =?Utf-8?B?RGFiYmxlcg==?=
    Jun 19, 2006
  4. JJA
    Replies:
    1
    Views:
    499
    Cowboy \(Gregory A. Beamer\)
    Sep 15, 2006
  5. ZZ_Scarab
    Replies:
    3
    Views:
    1,112
    Juan T. Llibre
    Aug 17, 2007
Loading...

Share This Page