I am trying to get an encrypted querystring on a ActionResult
but the parameter is always null.
I have implemented an e-mail URL and encrypted some informations like this:
string key = "r0b1nr0y";
var queryString = EncryptDecryptQueryString.Encrypt(String.Format("testId={0}&otherInfo={1}", Id, otherInfo), key);
It is resulting in this URL parameter:
?fpZG2mFDOZbuuBFccKLeu9Rzbn/I05i577IaaMSt0uztuHmWdeVIOQ==
And the url is something like this:
www.test.com/MyController/MyAction?fpZG2mFDOZbuuBFccKLeu9Rzbn/I05i577IaaMSt0uztuHmWdeVIOQ==
Now, at the controller side, the ActionResult
is suppose to receive a string.
Running the program, when i try to test the generated url, the code reach MyAction
but the string parameter is always null.
public ActionResult MyAction(string queryString)
{
... Do Stuff here...
}
I have tried to create a specific route for it as well(like this example), but didn't work.
routes.MapRoute(
"RouteTest",
"MyController/MyAction/{queryString}",
new { controller = "MyController", action = "MyAction", queryString = "" }
);
I can take the whole url with Request.RawUrl
, but i really can't understand why the encrypted string parameter is null(or empty).
Have i missed the point somewhere or is there an explanation for the null parameter value?