Search code examples
c#asp.netmdfloginview

loginview change data source


I have recently created an asp.net page in visual studio 2010. I have not changed any of the prebuilt loginview code. It creates the MDF file that allows for logging in users and registering users. However, I don't want to use the MDF file, I want to use a SQL Server instance i have running (lets call it MyServer) with a database MyDatabase. Where is the code that connects to the MDF file and is there a clean way of changing the data source? Thanks!


Solution

  • You can modify your string connection in your config file (Web.config)

    Modify this section

    <connectionStrings>
       <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=../File.mdf; Integrated Security=True;Connect Timeout=30;User Instance=True;Trusted_Connection=Yes"/>
    </connectionStrings>
    

    With for example this

    <connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;"/>
    </connectionStrings>
    

    Link : http://www.connectionstrings.com/