How do I replace the value of Request.Url.Query with String.Empty in the following snippet?
linkCanonical = "<link rel=\"Canonical\" href=\"" + Html.ViewContext.HttpContext.Request.Url + "\" />";
I know it isn't best practice. This is for a temporary fix.
If you want to remove the entire querystring you could use
Request.Url.Host + Request.Url.AbsolutePath
This takes the host and ONLY the path information
Using http://www.test.com/mypath.aspx?id=1
as an example it would give you www.test.com/mypath.aspx
Here is the MSDN documentation as well to help you through the properties.