Solved

PasswordFormat Only Accepts Clear

Posted on 2011-02-18
3
397 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

634 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