Last post May 02, 2013 03:53 PM by psinet
May 01, 2013 04:14 AM|paresh89|LINK
Hey , I have single user application. I want to store username and password in xml file. It is like:
<add user="admin" password="root" />
How should i read it to validate and password and change password stored in it. Please help thanks
May 01, 2013 04:38 AM|sangeeth2007|LINK
You can use app.setting if your are using a windows application
<add key="username" value="user"/>
<add key="password" value="pwd"/>
use ConfigurationManager.AppSettings["username"] to read the content.
to save the data back OpenExeConfiguration.here is a good example of how to do
Please add reference to System.Configuration;
make sure to encrpt the password before storing
May 02, 2013 03:53 PM|psinet|LINK
You actually don't need a seperate xml file to do this. You can store the account information in the web.config and then use the built-in FormsAuthentication to validate the account.
<forms loginUrl="~/SignIn.aspx" defaultUrl="~/Default.aspx">
<user name="testUser1" password="testPass1"/>
Here's a write up on it, Authentication using web.config credentials.