Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect Syntax

Status
Not open for further replies.

knight1001

Technical User
Nov 29, 2004
14
GB
I want to redirect to a page within the server. But i'm not entirely sure about the syntax.
I thought it was Redirect = "url"; but this gives the error msg of Unrecognised Escape Sequence.

Code:
private void Login(object sender, EventArgs e)
{

  connectionpartthree = new OleDbConnection("provider=microsoft.jet.oledb.4.0; data source=" + Server.MapPath(".") + "\\F1.mdb;");

 // if (!(IsPostBack))
  {
	commandpartthree = new OleDbCommand("SELECT COUNT(*) FROM Users WHERE Username = @Username AND Password = @Password;");
    commandpartthree.Connection = connectionpartthree;
	connectionpartthree.Open();
	commandpartthree.Parameters.Add("@Username", OleDbType.VarChar);
	commandpartthree.Parameters.Add("@Password", OleDbType.VarChar);
    commandpartthree.Parameters["@Username"].Value = Username.Text; 
    commandpartthree.Parameters["@Password"].Value = Password.Text; 
    int intExists = (int)commandpartthree.ExecuteScalar();

    if (intExists == 0)
    {
	  LabelStatus.Text = "Username or Password Incorrect";
	}
	else //this is where i thought the redirect should go
	{
	  LabelStatus.Text = "<a href="members.aspx">Proceed</a>";
	}
   }
 }
 
Response.Redirect("whereYouWantToGo.aspx",true);
 
Use a Literal control not a Label
LiteralContorl.Text = "<a href="members.aspx">Proceed</a>";


Keeping it Real, Simple!
 
Or a hyperlink control

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top