Apr 2 2007

Enable Fiddler on FireFox

Category:Bil@l @ 16:08

I was trying to debug an ASPX page today on FireFox to see what was going on. I usually use Fiddler to do this especially when I want to know what is being send/received. I wanted to debug on FireFox however, I noticed that Fiddler doesn't work on Firefox without some configuration settings.

Please check this URL to see how to enable Fiddler on FireFox:
http://nil.checksite.co.uk/index.cfm/2006/4/12/Using-Fiddler-with-Firefox

 

Hope this helps,
Regards

Tags:

Apr 1 2007

PasswordRecovery in ASP.NET 2.0 Membership API

Category:Bil@l @ 14:10

I have been lately developing a small website where I used the ASP.NET 2.0 Membership API to manage my users, create new users, etc ...

I decided however, not to use any of the built-in controls present on the VS 2005 toolbox to create new users, login, etc ... But, I made use of the Membership API instead. So everything was done programmatically using the Membership API to create new user, password recovery, login, etc ...

One thing I noticed that the Membership API has so many methods that come handy in such a solution except a PasswordRecovery method. There is GetPassword() method, however, so many other checking need to be done for example, does the current Membership Provider allow Password Retreival? Do retreiving a password requires a Question/Answer?

I found myself writing a small utility method that does all this checking and can be added to the Membership API methods to help you create a user management system programmtically, where alll functionalities are present!

Have a look at the code with the comments inside.

        /// <summary>
        /// Recovers a password given the username, secret question/answer.
        /// It can be used to recover password programmatically
        /// </summary>
        /// <param name="userName">UserName to which to recover the password</param>
        /// <param name="answer">The Secret Answer</param>
        /// <param name="status">Holds any messages of failure</param>
        /// <returns>Password to be recovered</returns>
        public static string PasswordRecovery(string userName, string answer, out string status)
        {
            // Initialize the status
            status = "";
            string pwd = "";

            // If the current provider configuration does not
            // allow password retrieval, go back
            if (!Membership.EnablePasswordRetrieval) {
                status = "Current Membership provider configuration doesn't allow password retrieval";
                return "";
            }

            // Check if the current provider requires question/answer
            // and check if the corresponding inputs are ok
            if (Membership.RequiresQuestionAndAnswer)
            {
                if (string.IsNullOrEmpty(answer)) {
                        status = "Secret answer is missing";
                    }

                if (status != "")
                    return "";
            }               

            // Validate the input
            if (string.IsNullOrEmpty(userName)) {
                status = "UserName is empty or null";
                return "";
            }

            // Get the user with the above username
            MembershipUser user = Membership.GetUser(userName);
            if (user == null)
            {
                status = "UserName doesn't exist in the database";
                return "";
            }
            else {
                // If provider is configured to use Secret question/answer
                // use the overloaded version of the GetPassword to pass in
                // the secret answer
                if (Membership.RequiresQuestionAndAnswer)
                {
                    try
                    {
                        pwd = user.GetPassword(answer);
                    }
                    // If answer is wrong, usually a MembershipPasswordException
                    // is usually thrown.
                    catch (MembershipPasswordException ex)
                    {
                        status = "Secret answer is wrong";
                        return "";
                    }
                }
                else {
                    // Retrieve the password without the secret answer
                    pwd = user.GetPassword();
                }

                // Password is OK
                status = "";
                return pwd;
            }
        }

Hope this code helps!
Regards

Tags:

Apr 1 2007

Once again a Visual Developer ASP/ASP.NET MVP

Category:Bil@l @ 09:58

I have been awarded the Visual Studio - ASP/ASP.NET Award for the 3rd consecutive year!

Hope this year will be a fruitful year too in helping the community in growing up, sharing more and more knowledge with the personal hope of ASPing the whole world [;)].

 

Regards

Tags:

Mar 27 2007

We are back - LebDev Community Nights

Category:Bil@l @ 21:21

We are finally back!!!

This Thursday, March 29 2007 we will deliver the come-back Community Night. The session will be delivered by Tarek Bouhsali - Microsoft Technical Manager and the session will be about: Windows Communication Foundation!

If it happened you are around, drop by and enjoy the session! For more information, check www.lebdev.net

 

Best Regards,
Bilal

Tags:

Mar 26 2007

New Forum in Town!

Category:Bil@l @ 21:40

I kindly invite you to check the new forum: www.programminghelp.com to get more help on your development problems whether they are .NET or other than .NET, CSS, HTML, and much more!!

The site is worth visiting and communicating there!

 

Regards

Tags:

Mar 2 2007

The DREAM came true!

Category:Bil@l @ 20:20

I have been posting lately about my “DREAM” and wondering when that dream will come true!