How to use FormsAuthentication class in Desktop application (VB.net)?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
how can I use FormsAuthentication.HashPasswordForStoringInConfigFile Method in my vb.net application
I would like to achieve the same PHP crypt() function for encrypting password.
However I've only seen FormsAuthentication class being used in asp.net, not in vb.net
So I was wondering what should I do in order to use that method in my desktop application.
 
..NET has a very well designed authentication and authorization
infrastructure. It is all based off of the IIdentity and IPrinciapl
interfaces. I would start looking at them. There are GenericIdentity and
GenericPrincipal classes already built that you can use or you can create
your own classes that implement the interfaces and create your own.

Just as in ASP.NET, you will have to build your own login form. There you
will need to establish the objects and tie them to the thread
(Thread.CurrentPrincipal = yourPrincipalObject). Then you can check the
roles (Thread.CurrentPrincipal.IsInRole("xxx")) to determine the
functionality that will execute or look at the PrincipalPermissionAttribute
for locking down whole methods and classes.

As far as encryption, passwords are normally encrypted with a 1 way
function. Have a look at the SHA1Managed class for that. You can do
reversible encryption as well, but that is quite a bit more in depth and not
recommended for passwords anyways.

--
Eric Marvets
Principal Consultant

the bang project

<shameless self promotion>

Email (e-mail address removed) for Information on Our Architecture and
Mentoring Services

</shameless self promotion>
 
Hi
does that mean I can't use FormsAuthentication class in my VB.net application
Does that mean I can only use "system.Security.Cryptography.SHA1"
I can't seems to get the password encrypted right

For example if my password is "myownpwd", after encryption it should return me "my47.JHDDF6Qo
I have earlier used php crypt() to encrypt all the passwords. The salt is the same as the password itself

Please advice me how can I get it right my VB.net application. Thanks alot.
 
Back
Top