Overlay images onto a page using LightBox2

26 09 2007

A friend recently asked me to produce a photo album of his recent wedding.  I thought ‘why not just use Picassa Web Album?’.

Well I was already hosting his web site, and he actually suggested me hosting his album too.  Simply by adding a obfuscated URL path to his current website address and then providing a few HTML pages with the thumbnails of his pictures, I could quite easily achieve that.

First thing I had to do is upload smaller versions of the photos, and I did this using Adobe Photoshop, using the Automated Batch facility to resize the files to 20% of their original size.

I then set out to produce the HTML & CSS, which was basically some very simple headers, a dark background and a special ‘Thumbnail’ DIV to hold each image, all floated left to ensure they all aligned next to each other.

Now I’ve seen this particular technique before on quite a few web pages and especially other galleries, sometimes used by professional photographers.  The technique is to click on a thumbnail and overlay the thumbnail with a larger pop-up of the image.  This is all achieved using HTML, CSS and JavaScript.  I’m not a JavaScript guru, but there is quite a simple process to get this going.  Try this bit of kit at LightBox2!





FindControl on a CreateUserWizard template

26 09 2007

I wanted to be able to customise the CreateUserWizard control by adding some components onto the CreatedUser template such as a few labels, and then display the username and password in these labels.

The first thing is to ensure the code for this goes in the following event stub:

CreateUserWizard1_CreatedUser

You then need to access your labels on the template. Heres how:

Dim lbl As Label
lbl = CreateUserWizard1.CompleteStep.ContentTemplateContainer.FindControl("lblUsername")
lbl.Text = etc....

As easy as that!





First time using wordpress!

26 09 2007

Well I’ve been meaning to try out a blogging tool out for ages but just haven’t got round to it. So I’m going to try out the tool on a ‘trial-basis’ to see if I like it!

So here goes…





GetPassword exception in ASP.NET membership

26 09 2007

I tried a new method call today on ASP.NET MembershipUser.

Dim thisUser As MembershipUser = Membership.GetUser(thisUserName)

Then I called the following:

lbl.Text = thisUser.GetPassword

and got the following exception:

This Membership Provider has not been configured to support password retrieval.

After some investigation I noticed I needed the following in my web.config (Notice those in RED are the attributes that are required and were added in order to support the GetPassword method):

<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
connectionStringName="247Db"
minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0"
type="System.Web.Security.SqlMembershipProvider"
applicationName="/247App"
enablePasswordRetrieval="true"
requiresQuestionAndAnswer="false"
passwordFormat="Encrypted"
requiresUniqueEmail="false" />
</providers>
</membership>

Following these additions, you need to add the following to web.config. There is a automatic key generator at the following: machineKey Generator

<machineKey validationKey="11D7D8362528F04266ACACDDEA7..."
decryptionKey="4C0..."
validation="SHA1"/>

You should then be able to support the GetPassword method().

If you don’t add the machineKey then you’ll get a different error as follows:

You must specify a non-autogenerated machine key to store passwords in the encrypted format. Either specify a different passwordFormat, or change the machineKey configuration to use a non-autogenerated decryption key.

Nice error hey? This is part & parcel of understanding a lot of the ASP.NET membership framework, you fix something somewhere, and you end up with a different error somewhere else. Its a big learning curve but a worthwhile one at that!