Click here to Skip to main content
14,735,210 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have one POST variable "DEST", If post variable is null then I need to pass hardcoded value "app" .In Redirecttopage() method I have string builder "sbSourceString ".i am appending "sDest" and "userid" to this "sbSourceString ". I have issue while appending the variable. please find the sample code.
protected void Page_Load(object sender, EventArgs e)
{
string sDest = string.Empty;
if (!string.IsNullOrEmpty(Request.Form["DEST"]))
{
sDest = Request.Form["DEST"];
}
else
{
sDest = "app";
}
Redirecttopage();
}
private void Redirecttopage()
{
StringBuilder sbSourceString = new StringBuilder();
//sbSourceString.Append("dest=app&UserId=07-");//earlier code

}
so how to append my sDest to the string builder .

Please help guide me.

What I have tried:

searching in google.
searching in google.
searching in google.
searching in google.
Posted
Updated 1-Dec-17 10:15am
Comments
[no name] 20-Jul-17 15:24pm
   
"I have issue": Do you planned to tell us the issue?

Try using AppendFormat:
sbSourceString.AppendFormat("dest={0}&UserId=07-", sDest);
   
Thank you OriginalGriff. it worked
   
Comments
Richard Deeming 5-Dec-17 12:40pm
   
As we have REPEATEDLY told you, if you want to reply to a solution, click the "Have a Question or Comment?" button under that solution. DO NOT post your comment as a new "solution"!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900