Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With the foreach loop your page sends to the login page all the user/password pairs stored in your database together.</p> <p>I think that you should select a user and populate with it the form. Somenthing like:</p> <pre><code>@{ var db = Database.Open("MyDb"); var selectQueryString = "SELECT user_id,password FROM user_table WHERE user_id = @0"; var user_row = db.QuerySingle(selectQueryString, "YourUserName"); } &lt;form name="UpdateOrRac" method="POST" action="Login.cshtml"&gt; &lt;div&gt; &lt;input name="txtUserID" value="@user_row.user_id" readonly="readonly" /&gt; &lt;input name="txtPassword" value="@user_row.password" readonly="readonly" /&gt; &lt;input type="submit" value="Login" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p><strong>Edit</strong></p> <p>In response to your comment, yes, but now your target is clearer.</p> <p>To obtain a list of your acccounts with the possibility of login, the easiest way is to use a link to the Login page with a querystring with userid and password:</p> <pre><code>@{ var db = Database.Open("MyDb"); var selectQueryString = "SELECT user_id,password FROM user_table"; var user_row = db.Query(selectQueryString); } &lt;div&gt; @foreach(var row in user_row) { &lt;p&gt; @row.user_id &amp;nbsp;&amp;nbsp; @row.password &amp;nbsp;&amp;nbsp; &lt;a href="~/Login?id=@row.user_id&amp;pwrd=@row.password"&gt;Login&lt;/a&gt; &lt;/p&gt; } &lt;/div&gt; </code></pre> <p>You can get the passed data in the Login.cshtml page with this statements:</p> <pre><code>var user = Request.QueryString["id"]; var pwrd = Request.QueryString["pwrd"]; </code></pre> <p>If the security is a concern, you must consider that GET and POST are nearly the same (look at <a href="https://stackoverflow.com/questions/198462/is-either-get-or-post-more-secure-than-the-other">Is either GET or POST more secure than the other?</a>)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload