C # Razor Get Variable
1 answer
To get the data sent by the request GET
, you read QueryString
from Request
.
var id = HttpContext.Current.Request.QueryString["id"];
You should also add checks to make sure it exists QueryString[KEY]
so that you don't get NullReferenceException
it when it tries to find KEY
which is not.
+4
source to share