Is there an ASP.NET way to add parameters to the URL?
Posted on 2008-01-29
I have an onclick button that redirects the user to another page, but I need to add a parameter to the URL for the redirect. Considering all the scenarios, I have nested if statements to get the URL right like this:
Response.Redirect(Request.RawUrl + "&sticky=1");
Response.Redirect(Request.RawUrl + "?sticky=1");
I was hoping there was something built into .NET to add parameters to the URL, like a one liner or something. Can .NET take care of this or do I got to leave the mess like that? I'm worried there's some other scenario I'm not taking into account.