i don't know if this is the right forum for my problem.
i am making a web form(authentication). In my front.aspx i have 2 textboxes which ask for username and password. i also have a button(Login). if the user presses the button it will go to a page login.aspx. however, i am having difficulty passing the data from two textboxes to another page since in my login.aspx it will validate the username and password.
front.aspx
private
void btnlogin_Click(object sender, System.EventArgs e){
if (txtbox1.Text=="" || txtbox2.Text=="")
{
Response.Write("<script language='JavaScript'> alert('Fill data please!') <" + "/script>");
}
else
//still don't know the code on how to go to page login.aspx
Response.Redirect("login.aspx");// not sure if this is the right code
}
login.aspx
private
void Page_Load(object sender, System.EventArgs e){
// Put user code to initialize the page here string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=copernicus;" +"DATABASE=dals;" + "UID=harrha19;" + "PASSWORD=harrha;" + "OPTION=3";
OdbcConnection MyConnection =
new OdbcConnection(MyConString);MyConnection.Open();
string s = "SELECT * FROM StaffTable where PinProfile=txtbox1.text and Password=txtbox2.text"; OdbcDataAdapter da=new OdbcDataAdapter(s,MyConnection);
DataSet ds=new DataSet();
da.Fill(ds);
datagrid.DataSource=ds;
datagrid.DataBind(); }
i don't know how to call the data inputted in txtbox1 and txtbox to in front.asp
hope someone could help me. i'm stuck here...
thank you in advance.

authentication
Neil Kronlage - MSFT
HPEvju
i used this code to pass the username and password entered by the user to the other page.
Response.Redirect("Login.aspx name=" + txtbox1.Text + "&pass=" + txtbox2.Text)
Randy B
The approach you take to get user inputs on one page and transfer them on another page for validation is the right way in ASP. In ASP.NET we generaly tend to use the PostBack mechanism.
In the sense all the processing generally takes place in the context of the same page and we do not transfer the user to the next page just for executing a particular script.
So Ideally you would put the code for authentication right in the event handler the btnLogin_Click and let it do all the validation itself. In case you want to reuse the code that performs validation you could add a class library project to your solution, create a seperate class that takes the Username and Password to return the authentication details. Then this common class can be called from multiple places.
The third way is to create a User Control for Login and use this User Control to perform authentication.
Having said that unless you are using ASP.NET 2.0 there is no direct way to transfer the contents of one page to another - unless you resort to passing them through cookies, querystrings or session variables.
Regards,
Saurabh Nandu
www.MasterCSharp.com