BigMek Posted October 6, 2005 Posted October 6, 2005 Hi, i creating some security interface where user need to login or register before they can go into the main program, my problem here is whenever user type something in the form's text box which i created, how to make it store in the XML files, can somebody give a guide on this. THX! :) Quote
Diesel Posted October 7, 2005 Posted October 7, 2005 Here's a link on how to write an xml file. http://abstractvb.com/code.asp?A=1067 Quote
BigMek Posted October 7, 2005 Author Posted October 7, 2005 Thanks for your reply, i have try the solutions you provide, but it doesn't work. :( I would try to explain more details of my situation, i'm working this security interface on VB.net, i have make 3 Forms for this interface as below; 1) login screen 2) new user registration screen 3) a form of database to store the user's details using XML files, such as name and password but now the problem is whenever new user register it on the new user registration screen, how to make the value in the textbox they type, such as thier name and password would automatically store in the xml file, after clicking a button. (You know, its just like a typical login screen validation process for user whereby new user have to register before they could enter the program and existing user can direct login since their details has already been store in the database file in VB.net form) :rolleyes: Quote
BigMek Posted October 7, 2005 Author Posted October 7, 2005 Hiya, i have found some articles from MSDN website maybe some use to my project, but i'm not familiar with C#, can somebody be so good to convert the code for me into VB.net type, here's the code; :rolleyes: [C#] <script runat=server> private void Page_Load(Object Src, EventArgs e) { String email = Request.QueryString["UserEmail"]; if( null != email ) UserEmail.Value = email; } private void AddUser_Click(Object sender, EventArgs e) { if( !Page.IsValid ) { Msg.Text = "Some required fields are invalid."; return; } DataSet ds = new DataSet(); String userFile = "../users.xml"; FileStream fs = new FileStream(Server.MapPath(userFile), FileMode.Open,FileAccess.Read); StreamReader reader = new StreamReader(fs); ds.ReadXml(reader); fs.Close(); string hashedpwd = FormsAuthentication.HashPasswordForStoringInConfigFile (UserPass.Value, "SHA1"); DataRow newUser = ds.Tables[0].NewRow(); newUser["UserEmail"] = UserEmail.Value; newUser["UserPassword"] = hashedpwd; ds.Tables[0].Rows.Add(newUser); ds.AcceptChanges(); fs = new FileStream(Server.MapPath(userFile), FileMode.Create, FileAccess.Write|FileAccess.Read); StreamWriter writer = new StreamWriter(fs); ds.WriteXml(writer); writer.Close(); fs.Close(); Response.Redirect("../Default.aspx"); } </script> Thanks in advance ! :p Quote
BigMek Posted October 9, 2005 Author Posted October 9, 2005 Can somebody help me translate the code above please :p :p :p :rolleyes: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.