This topic is locked

Auto-login passing username and password via URL

7/25/2019 6:12:04 PM
ASPRunner.NET Tips and tricks
Sergey Kornilov admin

Please note that passing username and password via URL is very insecure. Use it for internal applications only.
The following code needs to be added to AfterAppInit event. It takes full advantage of Security API.

if (MVCFunctions.postvalue("username") && MVCFunctions.postvalue("password"))

{

if (Security.checkUsernamePassword(MVCFunctions.postvalue("username"), MVCFunctions.postvalue("password")))

Security.loginAs(MVCFunctions.postvalue("username"));

}


And now you can try to run it in the web browser as

https://yourwebsite.com/login?username=...&password=...