[thelist] Using variables with Response.Redirect

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Dec 23 19:14:44 CST 2005


Hi Ryan,

   As always, my first question is "What do you mean by 'this doesn't work'?"  Is there an error?  If so, what is it?

   What happens when you do this?

baseURL += "/images/image.gif";

Response.Write(baseURL);

   Do you see what you expect?

Cheers,

Peter

 From: Ryan Rushton web at ryanrushton.com

I'm trying to replace a hardcoded string with a variable as follows:

// THIS WORKS //
private void validate() {
Response.Redirect ("http://www.mysite.com/images/image.gif 
", true);
}

// THIS DOES NOT //
string baseURL = "http://www.mysite.com ";

private void validate() {
Response.Redirect (baseURL + "/images/image.gif", true);
}

I'm new to ASP.NET ... could someone tell me what I'm doing wrong above?

-- Ryan



More information about the thelist mailing list