locked
Setting up the login databases RRS feed

  • Question

  • User-587791369 posted

    Hi,

    I am trying to create a website which has some pages limited to logged in users.  I can make it work on my local machine but cannot work out how to point to a remote database.

    I have created the remote SQL database using regsql, the command looks like this:

    "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe -S "Server" -U UserName -P Password-A all -d database"

    I guess this worked as when I look at my database I can see all the relevant tables, Users, Roles Membership etc.

    I then click on Configure ASP.NET to use the administration tool.  I tried to set up using Internet as the security option and this tells me to go onto the provider tab.  I go to the Provider tab and all I can do is click on test which fails ans tells me to go to regsql which I have already done.

    What have I missed out??

    cheers

    Sue

    Monday, February 25, 2013 11:00 AM

Answers

  • User-587791369 posted

    Hi, problem now resolved.  The only issue was my connection string.. the format of this which worked is:

     

    <add name="ApplicationServices" connectionString="Data Source=&quot;mssql.aspnethosting.co.uk, 14330&quot;;Persist Security Info=True;User ID=XXX;Password=XXX;Initial Catalog=XXX_Database"       providerName="System.Data.SqlClient" />

     

    Thanks

    Sue

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 27, 2013 7:54 AM

All replies

  • User-851967432 posted

    Is your connection string in the web.config pointing to the remote db or your local one?\

    Monday, February 25, 2013 11:25 AM
  • User-587791369 posted

    The remote db with this command..

     

    <connectionStrings>

            <add name="ApplicationServices" connectionString="data source=&quot;mssql.aspnethosting.co.uk, 14330&quot;;Integrated Security=SSPI;User Instance=true" providerName="System.Data.SqlClient"/>

      </connectionStrings

     

    In the configuration tool on the provider page I get:

    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 in security I get:

    There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
    The following message may help in diagnosing the problem: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

     

    The error I get if I run it is :

    Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

    Monday, February 25, 2013 11:50 AM
  • User-851967432 posted

    Yes that data source is expecting the database locally. You need to give it a protocol such as http:// and the database much allow remote connections

    Monday, February 25, 2013 12:11 PM
  • User-587791369 posted

    OK, that makes sense, I tried changing the web.config to say:

     

    <add name="ApplicationServices" connectionString="data source=&quot;http://mssql.aspnethosting.co.uk,14330&quot;;Integrated Security=SSPI;User Instance=true" providerName="System.Data.SqlClient"/>

    but I still get this error..

    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.

     

    Is my syntax correct?  Do I need to run the regsql tool again?

    I have used this database for other aspects of my websites without a problem so I assume it accepts remote connections, could different tables have different settings?

    Monday, February 25, 2013 12:28 PM
  • User-851967432 posted

    Well,

    Before I did anything else, I would put that URL into management studio using Windows Authentication to see if you can connect. If you can't connect that way, the problem isn't in your application, it's in the database configuration.

    Monday, February 25, 2013 12:33 PM
  • User-587791369 posted

    OK, I am using management studio with SQL authentication and I can't get to it using Windows Authenication so I guess that is my problem.  I will try and change my database configuration.

     

    Many thanks for your help

     

    Monday, February 25, 2013 12:41 PM
  • User-587791369 posted

    Is this something I can change within Server management studio??

     

    I am a bit confused, I thought the idea of using authentication mode=forms was to avoid logging in via windows??

     

    Undecided

    Monday, February 25, 2013 12:52 PM
  • User-851967432 posted

    No...forms authentication uses a login/password.

    To save yourself the headache and for security reasons, you can use forms authentication. Windows Authentication on a remote database is as dangerous as it gets. All someone would have to do to hack in is change the PC Name and create an account the same as yours. There is no password protection.

    Monday, February 25, 2013 12:56 PM
  • User-851967432 posted

    Create an acccount on your remote database and try to login using Management Studio w/SQL Authentication

    Monday, February 25, 2013 12:57 PM
  • User-587791369 posted

    Sorry I'm not sure what you mean...

     

    I know I can create a user on the remote database and login to the database via Management studio using SQL authentication, or do you mean create a User for my website which uses SQL authentication?? If it is the latter I don't see how I can do that....

    Monday, February 25, 2013 1:10 PM
  • User-587791369 posted

    Hi, problem now resolved.  The only issue was my connection string.. the format of this which worked is:

     

    <add name="ApplicationServices" connectionString="Data Source=&quot;mssql.aspnethosting.co.uk, 14330&quot;;Persist Security Info=True;User ID=XXX;Password=XXX;Initial Catalog=XXX_Database"       providerName="System.Data.SqlClient" />

     

    Thanks

    Sue

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 27, 2013 7:54 AM