Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, November 8, 2011 12:12 PM
I am getting this error message, Syntax Error, ':' expected, on the following line of code:
Response.Redirect("Launch.aspx"?FileName=" & FileName & "");
Anyone any ideas how to solve this?
Thanks.
All replies (3)
Tuesday, November 8, 2011 12:16 PM ✅Answered | 1 vote
Hi JMcCon,
You need to concatenate the string correctly, it's easier to spot errors if you break it down a bit:
string url = string.Format("Launch.aspx?FileName={0}", FileName");
Response.Redirect(url);
You are using & instead of + and you have one " to much.
Hope this helps
Mark good replies as helpful and correct ones as answers! - http://blog.filipekberg.se
Tuesday, November 8, 2011 12:18 PM ✅Answered
Response.Redirect("Launch.aspx" **? ** FileName=" & FileName & "");
You use the ?: Operator, but without the :. Therefor the error occurs. But the ?:-operator requires a bool at the left side of the ? ... And strings are added together by using +...
Response.Redirect("Launch.aspx?FileName=" + FileName); //Maybe this fits your needs
Tuesday, November 8, 2011 12:41 PM
Thanks guys, you were both correct.
Would any of you know how to resolve this one:
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/6f0c1914-be9f-4512-9edc-2769658cd8d6
Thanks.