Mar 22, 2010

LINQ MOST IMPORTANT FOR U AND ME

Introducing LINQ Tutorial

These reference sites that might help you:

Wikipedia: http://en.wikipedia.org/wiki/Language_integrated_query
CodeProject: http://www.codeproject.com/KB/linq/
LINQ Video: http://windowsclient.net/learn/videos_LINQ.aspx , http://www.asp.net/learn/linq-videos/
LINQ Article by Anders: http://msdn.microsoft.com/en-us/library/bb308959.aspx
LINQ at MSDN: http://msdn.microsoft.com/en-us/library/bb397926.aspx
LINQ Project Home page at MSDN: http://msdn.microsoft.com/en-us/netframework/aa904594.aspx
LINQ FAQ: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=307705&SiteID=1

ScottGu's Blog
# Part 1: Introduction to LINQ to SQL
# Part 2: Defining our Data Model Classes
# Part 3: Querying our Database
# Part 4: Updating our Database
# Part 5: Binding UI using the ASP:LinqDataSource Control
# Part 6: Retrieving Data Using Stored Procedures
# Part 7: Updating our Database using Stored Procedures
# Part 8: Executing Custom SQL Expressions
# Part 9: Using a Custom LINQ Expression with the control)


Step by step...
Introducing LINQ – Part 1
Introducing LINQ – Part 2
Introducing LINQ – Part 3
Introducing LINQ – Part 4
Introducing LINQ – Part 5

Mar 18, 2010

Asp.Net Membership: How to change a user's password from an admin account without knowing the current password?

Asp.Net Membership: How to change a user's password from an admin account without knowing the current password?



Like mine, you may also need to change a user's password from an admin account. By default, when you are using ASP.Net authentication and storing the password in the hashed format, you will not be able to see the existing password in its decrypted form. Also, to change a password using the Membership API, you will need to know the existing password. However, here is a simple solution to the problem -

AspNetChangePassword

The idea is, you can reset the password of a user using the following code-

string tempPass = Membership.Provider.ResetPassword("username", string.Empty)

Make sure you have the config that allows you to change password without an answer to the security question. Now, you can invoke the ChangePassword method using this tempPass as the existing pass and your custom password as the new password. Refer to the following line for a compact implementation-

Membership.Provider.ChangePassword("username", Membership.Provider.ResetPassword("username", string.Empty), "custompass")

I believe this will save your time with a similar need.