I am trying to store my web address in a variable, but I keep getting an error of
Cannot implicitly convert type 'System.Collections.Specialized.NameValueCollection' to 'string'
ANd this is my syntax
protected void Page_Load(object sender, EventArgs e)
{
GetKeyInfo();
}
protected void GetKeyInfo()
{
//The below line is the problem line
string fulladdress = HttpContext.Current.Request.Url.Query;
Response.Write(fulladdress);
string parsed = System.Web.HttpUtility.ParseQueryString(fulladdress);
}
EDIT
This is the address shown in browswer where I am attempting to run this
http://www.internaltesting.com/PassingDataTest/default.aspx?Information=https://XXX.XXX.X.XXX/all?token=1&cid=1832&employeeid=16432
And this is full error that is given
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 29: string fulladdress = HttpContext.Current.Request.Url.Query;
Line 30: Response.Write(fulladdress);
Line 31: var parsed = System.Web.HttpUtility.ParseQueryString(fulladdress);
Line 32: string token = parsed["token"];
Line 33: string employeeid = parsed["employeeid"];
EDIT
Is this the line from web.config you are after
<compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies> </compilation>