masky666
June 19th, 2009, 04:25 AM
Hi, can anyone give me some suggestions and examples how to create login system using VB.NET .. (usernames and passwords are stored in mysql database) ... Thanks.
|
Click to See Complete Forum and Search --> : Login form using mysql database masky666 June 19th, 2009, 04:25 AM Hi, can anyone give me some suggestions and examples how to create login system using VB.NET .. (usernames and passwords are stored in mysql database) ... Thanks. Shuja Ali June 19th, 2009, 05:34 PM Visual Studio has a built in Login Form. Try looking at that and then start building your own form. Right click on the Project in the solution explorer, select Add--> Add New Item and then search for the Login form in the dialog. That is all you would need. masky666 June 21st, 2009, 10:25 AM I found login form, and it works.. connection to database and everything is fine except 1 thing... When I build application it works fine, but If I for example open it with hex editor, I can read all database details how application connecting to DB.. so anyone who opens application with hex editor will be able to take details from there and ruin my database.. how to prevent that? should I encrypt the code somehow or what... Any suggestions please... sotoasty June 21st, 2009, 11:48 AM If you are worried about that then you should set up access in MySQL for each user that connects to the DB. Use the grant tables, then make that user login with those credentials. After the use enters his username and pw, you build your connection string from that, then MySQL will hand the authentication. If the connection fails, then the login was un-successful. Shuja Ali June 21st, 2009, 03:06 PM You should not be putting the database connection details in the code. It is better to put it in a configuration file. Also if you are worried about your database being compromised, you should look at building a web based application rather than a windows application. masky666 June 22nd, 2009, 05:54 AM I using login form, so users can actually login using username and password stored in database... but I don't want anyone to ruin the DB... masky666 June 22nd, 2009, 05:55 AM and where config file should be located? Shuja Ali June 22nd, 2009, 02:54 PM If you are developing a Windows application, you can add an application configuration file to your project. Once this is done, you can then create a connection string in the config file and then encrypt the same so that users won't be able to see what is actually in the config file. masky666 June 22nd, 2009, 04:35 PM I added appconfig file (app.config) <connectionStrings> <add name="MysqlConnectionString" connectionString="server=ip; user id=user; password=pass; database=dbname" /> </connectionStrings> But how to link that to main app... On main app (without config file) Im using this.. Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim conn As MySqlConnection conn = New MySqlConnection() conn.ConnectionString = "server=ip; user id=user; password=pass; database=dbname" Try conn.Open() ...... (Also the question, how to encrypt app.config)? Shuja Ali June 22nd, 2009, 05:09 PM You need to replace the conn.ConnectionString with the connection string that you placed in the application configuration file. I am not sure which version of .NET you are using. Try looking at ConfigurationManager on MSDN. That should give you an insight in how to load values from the configuration file. masky666 June 22nd, 2009, 05:30 PM .NET Framework 3.5 and VisualStudio 2008 masky666 June 22nd, 2009, 05:43 PM I did like this... app.config <connectionStrings> <add name="mysqlconn" connectionString="server=srv; user id=usr; password=pw; database=db" /> </connectionStrings> main app Public Class LoginForm1 Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim conn As MySqlConnection conn = New MySqlConnection() conn.ConnectionString = ConfigurationManager.ConnectionStrings("mysqlconn") ((ERROR)) Value of .... Can not be converted to string. masky666 June 23rd, 2009, 06:31 AM Thanks for help m8, I found the solution. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |