You need to avoid double quotes:
string link = string.Format("<A HREF=\"http://webserver/?x={0}&y={1}\">Click here</A>", variable1, variable2);
If you really want to create the correct HTML with valid URLs, I would recommend the following to you:
var kvp = HttpUtility.ParseQueryString(string.Empty); kvp["x"] = variable1; kvp["y"] = variable2; var uriBuilder = new UriBuilder("http", "webserver", 80); uriBuilder.Query = kvp.ToString(); var anchor = new TagBuilder("a"); anchor.Attributes["href"] = uriBuilder.ToString(); anchor.SetInnerText("Click here"); string link = anchor.ToString();
source share