Monday, October 16, 2006

Annoying KB918899 issue resolved

As -many- have noticed the Cumulative Security Update for Internet Explorer (KB918899) that came a while ago caused major problems with IE6 (Internet Explorer 6) on XP and 2003 Server. Well, there's another fix now available (KB923996) that you can download directly (instead of the previous one where you actually had to get microsoft to send it to you). Update for Microsoft Windows XP (SP2), English version http://www.microsoft.com/downloads/details.aspx?FamilyID=ff9bc431-01f3-48e8-9a58-d701d2e60c1d&DisplayLang=en Update for Microsoft Windows XP (SP2), Swedish version http://www.microsoft.com/downloads/details.aspx?FamilyID=ff9bc431-01f3-48e8-9a58-d701d2e60c1d&DisplayLang=sv Update for Windows Server 2003 Service Pack 1 x64 Edition, English version http://www.microsoft.com/downloads/details.aspx?FamilyID=2b7b1d5b-0b08-432a-b552-857997513476&DisplayLang=en Hopefully this helps to make your experience smooth once again, P.

Sneaky, sneaky..

Seems Sitecore has released a new version of 5.3, namely Sitecore 5.3 RC3. Interesting.. feels like the final version will be arriving shortly. UPDATE The installer is a lot friendlier now, and it didn't crash once for me when installing it on my laptop that runs Vista. Good stuff! However, might just be my setup, but i was unable to create a new website in my IIS7, I just had the option to install it on the already existing website. Oh well, that's a really petty problem anyway since you can change it manually anyway you want. Take care, P.

Wednesday, October 11, 2006

Sitecore 5.3 & Vista RC2

So, i've been running Vista RC2 now on my laptop and I have to say that all this fuzz about bugs and crashes and whatever people keep screeming about all over the net seems -way- exaggerated.. well, either that or these people are trying to install it on a pc that was outdated even back when bellbottoms were cool.. Anyway, that's not the point. What i was getting to is that, for me, Vista is a huge improvement compared to todays systems, and that's good. However, there's always a catch, otherwise there's no point in writing about it, but considering that it's still just RC2 -hopefully- these issues will be fixed when it's released. Configuring things like IIS7, or even installing Web Applications Projects update for Visual Studio 2005, or "Atlas"/ASP.NET AJAX is anything but easy and user-friendly. After hours of failed installations I finally got them all running the way they should, and then I proceeded to my final goal, installing Sitecore 5.3.. Again, another no-go-zone (at least, for me). The installer crashed, bigtime, and pretty much won't let me do anything.. First up it crashes in the background after selecting the licence file, I get a notification saying that InstallDriver Module has stopped working.. What's interesting though is that I'm simply able to close the popup and continue with the installation. At this stage i'm going "Heeey, that's neat." but unfortunately that only lasts a minute until it throws another error: Error 1609:.. ASPNET user is not a valid user or group.. And that's where I'm at right now. Might have to manually configure the ASPNET user (shouldn't tho, but who knows?). If/When I get this up and running i'll post again.. UPDATE: Well, here's what has to be done:
  1. Make sure Vista is configured to recognize IIS6 actions/scripts etc. This can be done by checking the appropriate boxes under the IIS part of the "Turn Windows features on or off".
  2. Install .NET Framework 1.1 (and updates).
  3. Turn the UAP off (not sure if this really is needed, but that's what I did).
  4. Run the installer as administrator (right click the installer, "Run as Administrator").

For me it still crashes in the beginning with that InstallDriver Module error, but after that the installer runs (read "is now running" since i'm installing right now) smoothly..

UPDATE 2:

Well, the happiness of the first update was not kept alive for long. After the installation finished (which it did and that was nice) I'm now stuck at the next obstacle - When trying to access localhost all I got at first was an error message saying it couldn't read the config file and a wierd "Could not load all ISAPI filters for site". So, like every other time something goes wrong, I added Network Service and the other system roles to the website and it's content, allowing full access for ease of use. Voila, time to see the next error, and this one is regarding changes made to the handling of the actual web.config file itself. This part was a little more tricky since it's not at all that well documented..

Below is what i've done so far (and as of right now I'm not at all sure about this solution, maybe there's a best-practice way to go about all this, but since I haven't seen one yet I'll keep on trying).

  1. Create a system.webServer node
  2. Move HttpModules and HttpHandlers from system.web to system.webServer
  3. Rename HttpModules to modules
  4. Rename HttpHandlers to handlers

So far all I get is that it's missing a http handler and nothing will load, but perhaps I'll have it fixed soon..

UPDATE 3:

Well, this is a situation with IIS7 having two options to run the site in: "Classic .NET Mode" or "Integrated .NET mode", the later of the two is what they recommend for IIS7 and future versions. Fine, they want us to move up, that's alright. But right now I don't care, I just want it to run. So, if you want to try and load it into the Integrated .NET mode (which I'm trying to), keep thinking and comment, otherwise you can run a command in the command promt to switch it to Classic .NET mode.

%systemroot%\system32\inetsrv\appcmd.exe set app "SITENAMEHERE/" /applicationPool:"Classic .NET AppPool"

FINAL UPDATE:

When all else fails, admit you've probably done something stupid and save yourself the worry by simply scrapping the old installation and do a new one. Lesson learned.

Hope this will help you install it on Vista if you run across these problems as well.

Take care, P.

Wednesday, September 27, 2006

Atlas Example

Right, down to business then: Sitecore and "Atlas".

"Atlas" is pretty much microsofts approach to AJAX and the hype surrounding it, so it's quite obvious that it was not going to go away but instead turn into a new part of the framework (see Scott Guthrie's blog on the matter at http://weblogs.asp.net/scottgu/archive/2006/09/11/_2200_Atlas_2200_-1.0-Naming-and-Roadmap.aspx)

Downloads:

Now, there's more or less two ways of going about using "Atlas" to power your website, either you build your own custom extender, or you could go with the really easy way - use the UpdatePanel. For now, let's just go with the UpdatePanel approach. If you haven't installed "Atlas" on a already existing site that you want to enable "Atlas" on, don't worry, it's pretty easy to set up:
  1. Install "Atlas" (make sure the checkboxes are ticked to also install Visual Studio project template and to register the .asbx extension in IIS).
  2. Copy the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll) from its installation folder to your site's Bin folder.
  3. Open the Web.config file
  4. Add these elements as children to the <configuration> element <configSections> <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup"> <section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/> </sectionGroup> </configSections> <microsoft.web> <converters> <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/> <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/> <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/> </converters> </microsoft.web>
  5. Add/Integrate these elements as children to the <system.web> element <pages> <controls> <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/> <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/> </controls> </pages> <!-- ASMX is mapped to a new handler so that proxy javascripts can also be served. --> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/> </httpModules>
  6. Save the Web.config file.
  7. Add a reference to the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll).
  8. (Optional) You can now also add "Atlas" to the Toolbox in Visual Studio. Right click the Toolbox, chose "add tab", name it, then right click, "choose items..", and browse to the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll).

Phew! Ok, that's about it for the installation and messing with a already existing site, now on to the fun stuff.

If you've never tried it before you're going to have fun, "Atlas" is neat and easy to use (note tho that it's still not a full release, so if it for whatever reason does crash, well, sorry, not much to do then but to re-install it).

1: Adding a ScriptManager

Add this to the page you want to enable "Atlas" on.

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> </atlas:ScriptManager> Now, there's more stuff to add here if you want to, like automated error handling etc:

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> <ErrorTemplate> <div style="width: 450px; height: 300px; padding: 10px; border: solid 1px black; background: gray; text-align: left;"> <h1>Site error detected</h1> <p>An unhandled exception with the following message has occured on the server:</p> <p><span id="Span1" runat="server"></span></p> <p>We're sorry for any trouble this has caused you and will fix the problem as soon as possible.</p> <p><input id="Button1" type="button" value="OK" runat="server"/></p> </div> </ErrorTemplate> </atlas:ScriptManager>

Play around with it, you'll find more things to use i'm sure.

2: Adding a UpdatePanel

An UpdatePanel is pretty much a content-wrapper that will allow you to reload parts of the page (AJAX styled content refreshing instead of reloading an entire page) so let's look at that one. First up, we need to wrap our area with the tags.

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> </atlas:UpdatePanel> Next up, adding a ContentTemplate to define what within this UpdatePanel that's our actual content area.

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <div id="Div1"> </div> </ContentTemplate> </atlas:UpdatePanel> Now, let's add a nice looking UpdateProgress as well to show that something's going on when it loads

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <div id="Div1"> <atlas:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <div id="Div2"> <asp:Image ID="Image2" runat="server" ImageUrl="/images/loading2.gif" GenerateEmptyAlternateText="True" AlternateText="Loading.." /> </div> </ProgressTemplate> </atlas:UpdateProgress> </div> </ContentTemplate> </atlas:UpdatePanel> 3: Refreshing the content

It's nice to have the possibility to update content on the page, but unless we actually activate it there's no point, so let's add an automated update of the content using a TimerControl.

<atlas:TimerControl ID="tcExample" runat="server" Interval="10000" Enabled="true" OnTick="tcExample_Tick"> </atlas:TimerControl> Next we need to add the tick event to the UpdatePanel so that it knows when to update itself. This is done using a Trigger that we'll connect to the Tick event of the newly created TimerControl. Add the following code within the UpdatePanel section:

<Triggers> <atlas:ControlEventTrigger ControlID="tcExample" EventName="Tick" /> </Triggers> 4: Defining what to refresh/update

Well, now that we have automated updating partially set up, let's add something to actually refresh/update. For this example we'll use an image (simple, i know, but it's just for example purposes). Add the following image tag within the <ContentTemplate> section of the UpdatePanel

<asp:Image id="ExampleImage" runat="server"/> 5: The code so far

Now, if you've followed the steps above somewhat down each line your page should look something like this:

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> <ErrorTemplate> <div style="width: 450px; height: 300px; padding: 10px; border: solid 1px black; background: gray; text-align: left;"> <h1>Site error detected</h1> <p>An unhandled exception with the following message has occured on the server:</p> <p><span id="errorMessageLabel" runat="server"></span></p> <p>We're sorry for any trouble this has caused you and will fix the problem as soon as possible.</p> <p><input id="okButton" type="button" value="OK" runat="server"/></p> </div> </ErrorTemplate> </atlas:ScriptManager> <atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <atlas:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="/images/loading2.gif" GenerateEmptyAlternateText="True" AlternateText="Loading.." /> </ProgressTemplate> </atlas:UpdateProgress> <asp:Image id="ExampleImage" runat="server"/> </ContentTemplate> <Triggers> <atlas:ControlEventTrigger ControlID="tcExample" EventName="Tick" /> </Triggers> </atlas:UpdatePanel> <atlas:TimerControl ID="tcExample" runat="server" Interval="10000" Enabled="true" OnTick="tcExample_Tick"> </atlas:TimerControl> 6: Adding the final code

Almost done now, just one thing left, and that's to add the actual code we use behind the scenes. For this example i've used a simple sitecore structure to attach images to an existing item Sitecore - Content -- Home --- AtlasExample ---- Image 1 ---- Image 2 ---- Image Whatever ---- ...

The template that holds the images simply holds a Image field named "image", nothing more. The reason for having them located under one item is just for easy access through sitecore.

In the code we're gonna be using a ItemCollection and IEnumerator to move through the items and get the content.

protected static System.Collections.IEnumerator images; protected static ItemCollection imageItems;

First up, load the content into the collection when the page is first loaded:

protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitColl(); } } protected void InitColl() { if (Sitecore.Context.Item.HasChildren) { imageItems = new ItemCollection(); Item imageFolder = Sitecore.Context.Item.Children["AtlasExample"]; if (imageFolder!=null) { foreach (Item itm in imageFolder.Children) { imageItems.Add(itm); } images = imageItems.GetEnumerator(); SelectNextImage(); } else { this.ExampleImage.Visible = false; Sitecore.Context.ClientPage.ClientResponse.Refresh(this.ExampleImage); } } } protected void SelectNextImage() { if (imageItems!=null) { if (imageItems.Count>0) { if (images != null) { if (!images.MoveNext()) { images.Reset(); images.MoveNext(); } Item next = (Item)images.Current; Sitecore.Data.Fields.ImageField image = (Sitecore.Data.Fields.ImageField)next.Fields["image"]; this.ExampleImage.ImageUrl = "~/media library/Images/" + image.Src; this.ExampleImage.AlternateText = "AtlasExample"; } } } } Next, add the tick event that we stated in the TimerControl earlier.

protected void tcExample_Tick(object sender, EventArgs e) { SelectNextImage(); }

Now go ahead and build it and watch the results on your site.

8: Moving on

As you can see extending a site, even a sitecore powered one, with "Atlas" is really a piece of cake and is there for everyone's taking. Check out the Atlas control toolkit and the samples there for more details on how to extend with "Atlas" using custom extenders.

Further reading:

Take care, and have fun!

P.

Tuesday, September 19, 2006

Atlas loves Sitecore

Well, the title pretty much says it all. I've played around a bit with Atlas now, which b.t.w. is now called Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions, so scrap the whole "Atlas" namning thing, it's going to be incorporated into the asp: namespace by the looks of it. Moving on then: Including Microsoft AJAX Library / ASP.NET 2.0 AJAX Extensions was actually a lot easier than i thought, it's pretty much just install & use. I've started on an article (not finished yet) that will detail the steps/outlines of how you can do this in a few easy steps.. might have time to publish it later today, we'll see.. UPDATE: I'm afraid i don't have the time to finish the article, and seeing that i'm heading to New York tomorrow i'll either finish it there or when i get back. Take care! P.

Friday, September 15, 2006

Bugs?

Seems there's a bug in the template handling - it's impossible to add a external link via the link field. Try this:
  1. Create a template
  2. Add a Link field
  3. Save
  4. Create an Item based on the newly created template
  5. Try to add a external link using the link field

Notice that the dialog that opens up is in fact the dialog for Internal Link?

Hopefully this'll get fixed, or is already fixed perhaps?

UPDATE:

Keeping an eye open proves to be priceless at times, and this time i'm soooo proven wrong (the dropdown to the right, on the side of "insert link" includes the option to add a external link). Well, you live and learn. There's no bug what-so-ever, i'm the bug :)

P.

Wednesday, September 13, 2006

Sitecore 5.3

Well well well, quite the surprise for SDN5 users to see is the change from 5.3 Beta to simply 5.3 (RC2). This i've been waiting for with the restlessness of a child, so I'll post more later after I've used it for a while. To quote myself:
For those of you with access to sdn5 and curiosity to satisfy, run on over there and download it..
UPDATE: Well, the installer works better than before, but i still hope they will add the option to specify the prefix when installing on SQL, 'cause if they don't it'll be a pain to install on a server with existing solutions.. That's it for now, P.