我想创建一个简单的登录页面,而不是只注册我在SQL数据库中使用的用户名和密码.这就是我现在为button1写的内容:
string connection_string = "Path to database";
SqlConnection connect = new SqlConnection();
connect.ConnectionString = connection_string;
connect.Open();
string sql = "Select * FROM Register where username=@username and password=@password";
SqlCommand 1 = new SqlCommand("username",textbox1User.text);
SqlCommand 2 = new SqlCommand("password",textbox2pass.text);
Run Code Online (Sandbox Code Playgroud)
这就是我现在拥有的.我需要做其余的登录页面,如果值正常,那么我将被重定向到页面上.但我还需要知道如何通过键入url to file来保护页面不被其他用户访问.所以它应该只在我登录时才有用.