¿Cómo puedo agregar valores a querystring?Querystring - Agregar valores a querystring en C#
que estoy tratando de hacer esto:
String currurl = HttpContext.Current.Request.RawUrl;
var querystring = HttpContext.Current.Request.QueryString.ToString();
var PrintURL = currurl + (String.IsNullOrEmpty(querystring)) ?
HttpContext.Current.Request.QueryString.Add("print", "y") : string.Empty;
Pero me siguen dando este error:
Cannot implicitly convert type 'string' to 'bool'
todo lo que estoy tratando de hacer es obtener la URL actual y añadir Pring = y? a querystring
Correcto, pero debe explicar por qué. – SLaks
@Donut ¿No es HttpContext.Current.Request.QueryString readonly? – Magnus
@Donut: Como se mencionó, esto fallará porque 'Request.QueryString.Add()' no devuelve nada (nulo). – Nimrod