Solved

PasswordFormat Only Accepts Clear

Posted on 2011-02-18
3
380 Views
Last Modified: 2013-12-17
Hello,

I am trying to create a simple web page that uses SHA1-encrypted Forms authentication. However, I cannot get it to work.

web.config:

<authentication mode="Forms">
	<forms>
		<credentials passwordFormat="SHA1">
			<user name="user" password="hashedpwd"/>
	        </credentials>
        </forms>
</authentication>

Open in new window


Login page:

string userName = Login1.UserName;
string password = Login1.Password;
string hashpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1");
e.Authenticated = FormsAuthentication.Authenticate(userName, hashpwd);

Open in new window


When I try to login, it says the login was unsuccessful, but I have properly compared the hashed code entered in web.config and hashpwd.

Can anybody assist with this?
0
Comment
Question by:s_magic
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Shahan Ayyub
ID: 34932839
0
 
LVL 1

Accepted Solution

by:
s_magic earned 0 total points
ID: 34943671
Hello,

These sites already assisted me in getting the code I currently have.

I was able to resolve the issue. This site is a virtual directory inside another site, which had its own web.config file. That web.config file appears to have been conflicting with the web.config file I used for this project, as every time I put in the hashed password, it would cause a generic ASP error page. The main site does nothing right now, and I don't see it doing anything in the future, so I deleted the web.config file, and now my SHA1-encrypted form works. I think I remember reading somewhere online about conflicting web.config files, so this would make sense.
0
 
LVL 1

Author Closing Comment

by:s_magic
ID: 34986423
My steps in troubleshooting resolved the issue I was experiencing. The lone answer provided by an Expert were solutions that I had already discovered and worked through, however they were not showing desired results.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question