简体   繁体   English

asp.net | 更改位置网络表单保存用户数据

[英]asp.net| change the place webforms save user data

I am trying to change the place my webform saves the data. 我正在尝试更改Web表单保存数据的位置。

What I mean is, when you open a Visual Stuido/C# Web App, its has a user login/register data. 我的意思是,当您打开Visual Stuido / C#Web App时,它具有用户登录/注册数据。

The default data is saved in your project folder, in APP_DATA as: ASPNETDB.MDF . 默认数据保存在项目文件夹的APP_DATA中,为: ASPNETDB.MDF

What about if I want to use MSSQL Server 2008R2. 如果我想使用MSSQL Server 2008R2,该怎么办。

How can I change it? 我该如何更改?

Just setup a new database and change your connectionstring in the web.config : 只需设置一个新数据库并在web.config更改您的connectionstring web.config

Using SQL Server instead of ASPNETDB.mdf 使用SQL Server代替ASPNETDB.mdf

<connectionStrings>
  <add 
    name="NorthwindConnectionString" 
    connectionString="Data Source=serverName;Initial 
    Catalog=Northwind;Persist Security Info=True;User 
    ID=userName;Password=password"
    providerName="System.Data.SqlClient"
  />
</connectionStrings>

How to: Read Connection Strings from the Web.config File 如何:从Web.config文件读取连接字符串

在真正的服务器MS Server 2008R2中,您必须从“家庭”数据文件中进行备份:“在APP_DATA中为:ASPNETDB.MDF” ps对于我的英语不好对不起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM