Blog

Posts written in January 2009.

  • I currently have a SharePoint 2007 demonstration setup on a development environment. The SharePoint 2007 installation was originally setup for a specific client. So the host headers, computer name and farm credentials contained the client name. This all had to be changed. Carrying out another installation of SharePoint was something I did not want to do since I wanted to retain all the dummy data and sites.

    You might be thinking: Why don’t I just change the host headers with the new client name? Well that’s because I am a bit OCD and I like everything to be consistent. Tongue out

    To rename, carry out the following. But remember to carry out these steps exactly because you might come across the problem I did where I couldn’t get to Central Admin or view my Intranet:

    1. Go to Central Admin > Operations > Alternate Access Mappings.
    2. Change the host headers as required.
    3. If you changed the name of the server carry out the following command:
    stsadm -o renameserver -oldservername <oldname> -newservername <newname>
    
    1. Rename the server to a new server name by going to My Computer > Properties > Computer Name and restart.
    2. After restart you will need to update the farm login credentials since the computer name has been changed from Steps 3 and 4. If you do not update the farm credentials, you will get the dreaded “Cannot connect to database” message when trying to view your Intranet.
    stsadm -o updatefarmcredentials -userlogin <domain\user> -password <password>
    
    1. Change the site names in IIS. This site names will need to reflect the changes you made in Step 1.
    2. Change the host headers in the host file (C:\Windows\System32\drivers\etc\hosts).
  • ASP.NET Membership Provider makes implementing secure authenticating membership forms more straightforward. The ASP.NET Membership Provider contains so many useful methods. But I could not find a method within the Membership class to check whether there was an existing email address in the database even though you can state in the web.config (requiresUniqueEmail) file:

    <membership>
      <providers>
        <add
          name="SqlMembershipProvider"
          type="System.Web.Security.SqlMembershipProvider, ..."
          connectionStringName="LocalSqlServer"
          enablePasswordRetrieval="false"
          enablePasswordReset="true"
          requiresQuestionAndAnswer="true"
          applicationName="/"
          requiresUniqueEmail="true"
          passwordFormat="Hashed"
          maxInvalidPasswordAttempts="5"
          minRequiredPasswordLength="7"
          minRequiredNonalphanumericCharacters="1"
          passwordAttemptWindow="10"
          passwordStrengthRegularExpression=""
        />
      </providers>
    </membership>
    

    I created the following CustomValidator with a ServerValidate event to carry out the duplicate email check:

    protected void DuplicateEmailCheck_ServerValidate(object source, ServerValidateEventArgs args)
        {
            //Create MembershipUserCollection to collate a list of duplicate email addresses
            MembershipUserCollection memCollection = Membership.GetUserNameByEmail(args.Value.ToString());
    
            //If duplicate email addresses are found then error
            if (memCollection.Count > 0)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    
  • I came across a problem today when trying to find an effective way to validate the length of a password field within a registration form I was creating. ASP.NET already has a bunch of useful validation controls. Most of which I have already have in use within my registration form, such as the RequiredFieldValidator, CompareValidator and RangeValidator.

    Now you might be thinking. What’s your problem dude? Its not hard to validate the length of a field. Yeah, you are right. But all the validation controls I am using (above) do not create post backs. I could have easily created a CustomValidator control to solve my problem, but this only fires once a post back has occurred.

    I guess my only solution is to use a RegularExpressionVaildator which meant I had to do some research into RegEx. To use RegEx to validate the length of a string between 0 and y (some number), use the following expression:

    .{0,y}
    

    To validate the exact length, use the following expression:

    .{y}
    

    Both example’s above will accept any type of characters entered in the field.

  • Published on
    -
    1 min read

    I Feel It's Going Down 10 Feet Below The Ground

    microsoft_vista-logo Since the middle of 2008 we have seen that quite a few business have been hard hit by the recession we are currently experiencing. Things are set to get worse in 2009. Who would have thought that out of all the businesses in the world that the Microsoft monopoly would somehow be effected. I was quite surprised to read speculation across the web that for the first time ever in Microsoft's 33 year history,  15,000 of its employees across US and overseas divisions could be laid off and 3,000 UK employees face an uncertain future.

    Well I suppose this was bound to happen sooner or later since retail spending has been reduced and consumers are opting for open source operating systems such as Linux. You cannot beat getting something for free! Microsoft operating system, corporate and office licences could also suffer a hit due to businesses scaling down costs. Maybe if Microsoft stopped releasing crap bug filled software (like Windows Vista) they could have reduced their costs.

    Many companies are not even touching Windows Vista with a barge pole, due to the performance hungry features and poor reception. Generally, companies normally delay upgrading their operating systems, since they need to justify the impact on the business and of course costing's. There have been reports that Vista is installed on considerably fewer enterprise PCs than originally projected. Oop's, I went off on a bit of a tangent. Window's Vista really annoys me!!!

    Anyway, if Microsoft do go ahead with the redundancies, internetnews.com states that under performing areas, such as Entertainment and Devices Division and the Online Business Division will face the most brutal cuts.

  • Published on
    -
    1 min read

    Free McAfee Internet Security 2009

    McAfee-Internet-Security-2009-Free-3-Months-Trial What a way to start the new year with some free software (and I am talking the legal way). I found that my current PC Internet Security was soon to expire. Instead of renewing my existing Bullguard licence, I decided it was time for a change after being a loyal three year customer mainly because the yearly fee was starting to get a bit too expensive compared to other packages on the market.

    As usual I always look at the customer reviews on the Amazon web site, which is always useful. But this time I found one the reviews someone written more useful than others. It contained a coupon code for a free copy of McAfee Internet Security from the US McAfee website.

    All you need to do in order to get your free copy of McAfee Internet Security 2009 is to carry out the following:

    1. Go to http://us.mcafee.com/root/campaign.asp?cid=53347.
    2. Enter coupon code: VSPPROMOCF. You will magically see the Grand Total is now $0.00.
    3. Ensure that there is only one copy of Internet Security in your basket for one user.
    4. Click on the "Checkout" button and register your new account. This account will just contain details of when your year subscription will expire.

    Awesome!

    I am not too sure how long it is valid for. But give it a try. It worked for me!