ASP.NET+Javascript [modified]
-
Hi All, I am trying Javascript for Validation of a new User Registration. I want to know whether user already exits or not. I m trying to check it on Submit button. I want to do it through Javascript. I confused while mixing the code of javascript and ASp.net. I created a string array of all user already exist. now I want to check it in java script for new user's name. I m new to javascript. Please guideme thanks in advance,. Asp:
protected void Page_Load(object sender, EventArgs e) { con = new OleDbConnection(); con.ConnectionString = conString; con.Open(); cmdSelect = new OleDbCommand("select * from User_Information", con); da = new OleDbDataAdapter("select * from User_Information",con); ds = new DataSet(); da.Fill(ds); ArrayPassword = new string[100]; ArrayNames = new string[100]; for (i= 0; i < ds.Tables[0].Rows.Count;i++ ) { ArrayNames[i]=(ds.Tables[0].Rows[i].ItemArray[0].ToString()); ArrayPassword[i]=(ds.Tables[0].Rows[i].ItemArray[1].ToString()); } int j = ArrayNames.Count; string arr = ArrayNames; //Response.Write(ArrayNames[j - 1].ToString()); }
Javascript:function Validate() { for (var i=0;i; var j; var arrayNames=<%=ArrayNames%> ; // ERROR COMES IN THIS LINE....ANY CLUE for(j=0;j -- modified at 7:54 Tuesday 19th June, 2007 -- modified at 8:29 Tuesday 19th June, 2007 Bajrang Singh Using .net 2.0 (VS2005)
-
Hi All, I am trying Javascript for Validation of a new User Registration. I want to know whether user already exits or not. I m trying to check it on Submit button. I want to do it through Javascript. I confused while mixing the code of javascript and ASp.net. I created a string array of all user already exist. now I want to check it in java script for new user's name. I m new to javascript. Please guideme thanks in advance,. Asp:
protected void Page_Load(object sender, EventArgs e) { con = new OleDbConnection(); con.ConnectionString = conString; con.Open(); cmdSelect = new OleDbCommand("select * from User_Information", con); da = new OleDbDataAdapter("select * from User_Information",con); ds = new DataSet(); da.Fill(ds); ArrayPassword = new string[100]; ArrayNames = new string[100]; for (i= 0; i < ds.Tables[0].Rows.Count;i++ ) { ArrayNames[i]=(ds.Tables[0].Rows[i].ItemArray[0].ToString()); ArrayPassword[i]=(ds.Tables[0].Rows[i].ItemArray[1].ToString()); } int j = ArrayNames.Count; string arr = ArrayNames; //Response.Write(ArrayNames[j - 1].ToString()); }
Javascript:function Validate() { for (var i=0;i; var j; var arrayNames=<%=ArrayNames%> ; // ERROR COMES IN THIS LINE....ANY CLUE for(j=0;j -- modified at 7:54 Tuesday 19th June, 2007 -- modified at 8:29 Tuesday 19th June, 2007 Bajrang Singh Using .net 2.0 (VS2005)
-
Hi All, I am trying Javascript for Validation of a new User Registration. I want to know whether user already exits or not. I m trying to check it on Submit button. I want to do it through Javascript. I confused while mixing the code of javascript and ASp.net. I created a string array of all user already exist. now I want to check it in java script for new user's name. I m new to javascript. Please guideme thanks in advance,. Asp:
protected void Page_Load(object sender, EventArgs e) { con = new OleDbConnection(); con.ConnectionString = conString; con.Open(); cmdSelect = new OleDbCommand("select * from User_Information", con); da = new OleDbDataAdapter("select * from User_Information",con); ds = new DataSet(); da.Fill(ds); ArrayPassword = new string[100]; ArrayNames = new string[100]; for (i= 0; i < ds.Tables[0].Rows.Count;i++ ) { ArrayNames[i]=(ds.Tables[0].Rows[i].ItemArray[0].ToString()); ArrayPassword[i]=(ds.Tables[0].Rows[i].ItemArray[1].ToString()); } int j = ArrayNames.Count; string arr = ArrayNames; //Response.Write(ArrayNames[j - 1].ToString()); }
Javascript:function Validate() { for (var i=0;i; var j; var arrayNames=<%=ArrayNames%> ; // ERROR COMES IN THIS LINE....ANY CLUE for(j=0;j -- modified at 7:54 Tuesday 19th June, 2007 -- modified at 8:29 Tuesday 19th June, 2007 Bajrang Singh Using .net 2.0 (VS2005)
This is a disaster. You should never assume that ANYTHING on the client side is what you expect, anything you do in client side, should be validated on the server. It's trivial to hack your page, and make it accept any password you like. It's also trivial to view the source, and see all the username/passwords in your system. Even allowing SQL that returns all the user details is a mess and should be avoided. Please tell me you're just playing around, and no-one will ever rely on this code for security ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
This is a disaster. You should never assume that ANYTHING on the client side is what you expect, anything you do in client side, should be validated on the server. It's trivial to hack your page, and make it accept any password you like. It's also trivial to view the source, and see all the username/passwords in your system. Even allowing SQL that returns all the user details is a mess and should be avoided. Please tell me you're just playing around, and no-one will ever rely on this code for security ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Thanks Christian Graus for advice. I was just playing around. I will be highly thankful to you if you can tell me what the Mistake is there in following line
var arrayNames=<%=ArrayNames%> ; // ERROR COMES IN THIS LINE ,,,
Thanks again.Bajrang Singh Using .net 2.0 (VS2005)