In my dot net MVC application, I have a Login page where user enters username and password. On clicking submit button the username and password are sent in plain text over the wire. Is there a simple way in which I can send encrypted username/passwords from the login form and decrypt then in the controller on server side. OR if there is any simpler way to prevent passwords being sent in plain text? Thanks.
1 Answer
Just use HTTPS, it's what it is designed for and it will ensure that the username and password won't be sent in clear text over an unencrypted channel.
Also in your web.config you could require SSL for the authentication cookie which will ensure that it will never be transmitted over a non-encrypted channel.
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" requireSSL="true" />
</authentication>
2 Comments
sunny days
Hi, Thanks for the answer. I'm new to web technologies so Can you please guide me or provide a link on how to deploy my website so that it is SSL enabled. I'm using dot net mvc4 on IIS7. Thanks
Darin Dimitrov
You will need to install an SSL certificate on your web server. Configuring your web server is off-topic for StackOverflow. There are discussions about this on serverfault.com. Or just Google it. Here's the first hit I got: digicert.com/ssl-certificate-installation-microsoft-iis-7.htm