i want to hash my password to SHA1 algo, in asp.net code and then want to compare it with hashed password in sql 2008 db, for login

so how to hash it in asp.net code ?

So, this is not my area of expertise, but this is what I've done in the past....

Sub hashMe(ByVal pswd As String)
    Dim password As String = FormsAuthentication.HashPasswordForStoringInConfigFile(pswd, "SHA1")
End Sub

I'd suggest some additional research and/or hopefully getting some additional responses.

ok jorgem i converted it into c# and tried, it worked but the problem is that SHA1 i used in sqlserver2008 and the one i used in asp.net(c#), produces different hashes, which couldn't be compared at time of login ,

I suspect that the problem there is the way the string is being treated, differently in your asp.net page vs sql. (encoding).

Depending on the level of security required, you should consider salted password hashing.