by Anonymous » 21 Aug 2025, 07:02
Ich bin neu bei C#/Razor und weiß nicht, wie man Formdaten mit der Post -Methode übergibt. Hier ist, was ich ausprobiert habe: < /p>
In login.cshtml: < /p>
Code: Select all
string username = Request.Form["username"];
string password = Request.Form["password"];
< /code>
und < /p>
string username = Request.Form.Get("username");
string password = Request.Form.Get("password");
< /code>
In _Appstart.cshtml habe ich versucht: < /p>
AppState["username"] = HttpContext.Current.Request.Form["username"];
AppState["password"] = HttpContext.Current.Request.Form["password"];
< /code>
Alle geben nichts zurück.
Login
Ich bin neu bei C#/Razor und weiß nicht, wie man Formdaten mit der Post -Methode übergibt. Hier ist, was ich ausprobiert habe: < /p>
In login.cshtml: < /p>
[code]string username = Request.Form["username"];
string password = Request.Form["password"];
< /code>
und < /p>
string username = Request.Form.Get("username");
string password = Request.Form.Get("password");
< /code>
In _Appstart.cshtml habe ich versucht: < /p>
AppState["username"] = HttpContext.Current.Request.Form["username"];
AppState["password"] = HttpContext.Current.Request.Form["password"];
< /code>
Alle geben nichts zurück.
Login
[/code]