Solved

PasswordFormat Only Accepts Clear

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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