views:

127

answers:

2

Hi folks,

i noticed that a forms authentication element has an option child element called Credentials.

MSDN Online explains what it is, here.

That said, i don't understand what it would be used for? So i can add in a username and password (either clear/md5/sha1) to the config file.. but how/when is it used?

Is that an example of hard-coding in a username/password to be used with forms auth, instead of having a database? If so, is there any code behind? What happens if you also have a database with users/passwords?

cheers :)

+1  A: 

You're exactly right... hard-coded username/passwords. That's it in a nutshell. Only time I've actually used it is on a project where we wanted to work on some code that required authentication, but didn't have the real mechanism wired in. It's just a placeholder for real authentication so far as I'm concerned.

MSDN seems to agree, given the warning note at the top of the docs you link to. You can use it side-by-side with a DB, but why bother?

Bryan
Not sure why i'd both unless i didn't have a DB already setup. Was just curious to how/what the element is/does. cheers :)
Pure.Krome
A: 

I'm struggling with it right now in an MVC app, but the idea is to have a very simple username/password system for a lightweight internal-company application. It doesn't have a database of its own, nor do we want it to, so ASP.net Membership is out right now.

Oh, and AD auth is out of the question here, hence the simple credentials approach.

Amethi