Wie passieren Sie Postformularvariablen in ASP.NET C#/RAZOR?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie passieren Sie Postformularvariablen in ASP.NET C#/RAZOR?

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


Top