Answered by:
How to send parameters to action silently (not show in url)

Question
-
User283528319 posted
hi all,
instead of sending user id and <g class="gr_ gr_54 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="54" data-gr-id="54">pw</g> in <g class="gr_ gr_154 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="154" data-gr-id="154">url</g> like this
how can I open that action with silent <g class="gr_ gr_210 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="210" data-gr-id="210">sendin</g> of the parameters?
Tuesday, February 19, 2019 2:17 PM
Answers
-
User475983607 posted
yes, the thing is how can I do it?
An HTML form.
View with an HTML form that posts to the current action; Index in this case.
@{ ViewBag.Title = "Index"; } <h2>Index</h2> <form id="from" method="post"> <input id="Text1" type="text" name="Text1" value="Hello World" /> <input id="Submit1" name="Submit" type="submit" value="submit" /> </form>
Actions
[HttpGet] public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(string Text1) { return Json(Text1); }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 19, 2019 2:42 PM -
User283528319 posted
<g class="gr_ gr_57 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="57" data-gr-id="57">thanks</g> I kinda figure out what I need with the guidance of this message
and used this line to send the data to my action (rather than current page)
<form action="/home/<g class="gr_ gr_87 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="87" data-gr-id="87">myaction</g>" method="post">
<input name="UserName" (as my <g class="gr_ gr_174 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="174" data-gr-id="174">paramater</g> name) and value="Xman" (as my paramater value.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 19, 2019 3:34 PM
All replies
-
User475983607 posted
hi all,
instead of sending user id and pw in url like this
www.mysite/mypage?UserName=heloya@gmail.com&Password=xxzzz
how can I open that action with silent sendin of the parameters?
Never send a username and password in the URL; HTTP GET. The browser caches URLs which creates a security vulnerability. Submit the parameters using a POST over HTTPS.
Tuesday, February 19, 2019 2:34 PM -
User283528319 posted
yes, the thing is how can I do it?
Tuesday, February 19, 2019 2:37 PM -
User475983607 posted
yes, the thing is how can I do it?
An HTML form.
View with an HTML form that posts to the current action; Index in this case.
@{ ViewBag.Title = "Index"; } <h2>Index</h2> <form id="from" method="post"> <input id="Text1" type="text" name="Text1" value="Hello World" /> <input id="Submit1" name="Submit" type="submit" value="submit" /> </form>
Actions
[HttpGet] public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(string Text1) { return Json(Text1); }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 19, 2019 2:42 PM -
User283528319 posted
<g class="gr_ gr_57 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="57" data-gr-id="57">thanks</g> I kinda figure out what I need with the guidance of this message
and used this line to send the data to my action (rather than current page)
<form action="/home/<g class="gr_ gr_87 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="87" data-gr-id="87">myaction</g>" method="post">
<input name="UserName" (as my <g class="gr_ gr_174 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="174" data-gr-id="174">paramater</g> name) and value="Xman" (as my paramater value.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 19, 2019 3:34 PM