Solved

PasswordFormat Only Accepts Clear

Posted on 2011-02-18
3
376 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now