What's wrong with using a relative url?
downLoadUrl = "CertificateDownload.aspx?CertificateID=" + CertificateName
Much simpler.
Sam
2010-01-07 02:32:24
What's wrong with using a relative url?
downLoadUrl = "CertificateDownload.aspx?CertificateID=" + CertificateName
Much simpler.
Request.MapPath(string.format("CertificateDownload.aspx?CertificateID={0}", CertificateName))
You can do it cleanly with UriBuilder. Some people might say it's overkill, but it makes the intent of the code very clear and it's easier to program and maintain, and less error-prone.
var uriBuilder = new UriBuilder(HttpContext.Current.Request.Url);
uriBuilder.Path = Path.GetDirectoryName(uriBuilder.Path) + "/CertificateDownload.aspx";
uriBuilder.Query = "CertificateID=" + CertificateName;
var downloadUrl = uriBuilder.ToString();