Reputation: 659
I use openid in mvc3 razor, Please explain this code
<form action="[email protected](Request.QueryString["ReturnUrl"])" method="post" id="openid_form">
Upvotes: 0
Views: 108
Reputation: 2896
In short, it redirects the user to the 'Authentication' action* and passes along the current ReturnUrl query string parameter.
** , * Example: if you called this form from the page
http://localhost:56507/Home/Index?ReturnUrl=localhost%2fjumbo%20rob ,
it would redirect to
http://localhost:56507/Home/Authenticate?ReturnUrl=localhost%2fjumbo%20rob
Okay, let dissect the code.
<form action="[email protected](Request.QueryString["ReturnUrl"])" method="post" id="openid_form"
Its a form tag. The form tag has an action attribute. The action attribute of a form specifies where (the url) to which to send the form-data when a form is submitted. In this case, the url specified is "[email protected](Request.QueryString["ReturnUrl"])"
Lets dissect the url. 'Authenticate' is a name of the url where it goes and is likely an action in the same controller (the post url will only really replace the thing after the last slash this code is for a relative url).
The url then has a querystring with a paremeter called ReturnUrl. The value for this parameter is the url encoded form of ReturnUrl in the current window querystring. It re-encodes the querystring to reconvert the " "s to "%20"s, etc.
Upvotes: 1