Andrew's Blog

Random Thoughts of an ASP.Net Code Monkey

Handling Webpage Display Issues in Internet Explorer 8.0 using IIS

September 9, 2008 14:32 by Andrew Westgarth

I have been using Internet Explorer 8.0 since the release of Beta 1.  IE 8 requires more standards compliance in the code of web pages for them to display correctly.  Today I was catching up on my RSS Feeds and came across this very useful article - Configuring IIS to work around webpage display issues in Internet Explorer 8.0 and this article discusses the use of adding a HTTP Response Header which then informs IE to run in IE Compatibility mode, therefore rendering the page as it would render in Internet Explorer 7.

The article gives complete details of how to set this up on IIS6 and 7 (integrated and classic mode) and it is very straight forward.  I have implemented it on our live webserver but not on our development server - so we can fix the issues rather than relying on compatibility mode.  Also the default is to set this for your entire server, i.e. any sites, applications and pages served.  However by adding this remove tag into the root web.config of a site you can remove the use of the HTTP Response Header from that particular site and the site will run in true mode (remember to place the httpProtocol element within the system.webServer element in your configuration):

<system.webServer>
  <
httpProtocol>
    <
customHeaders>
      <
remove name="X-UA-Compatible"/>
    </
customHeaders>
  </
httpProtocol>
</
system.webServer>

I must stress I definitely see this as a temporary workaround and only as a backup plan to buy you a little time to sort out the rendering issues!  I would always advocate coding your XHTML and CSS to correct standards!!  Standards Compliance has many added benefits including search engine optimisation and accessibility benefits for users of your sites!!

Categories: ASP.Net | IIS
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

More Great Software for Free to Students From Microsoft

September 9, 2008 12:19 by Andrew Westgarth

In follow up to my previous post, Students!!! - Get MS Office Ultimate 2007 for 39 Quid! An Absolute Steal!!, I was reminded this morning about Dreamspark which is a great offer for Students to get hold of some excellent development and design software.  On offer for free to students who match the eligibility requirements are:

  • Microsoft Visual Studio 2008 Professional Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft Expression Studio
  • XNA Games Studio 2.0
  • Microsoft Windows Server 2003 Standard Edition - shortly to be updated to Windows Server 2008 (which includes IIS 7 ;))

This is an excellent offer and one which represents a massive saving for students wanting to develop on the Microsoft Platform.  For more information visit the Dreamspark Section on Channel 8.

Categories: Microsoft
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Students!!! - Get MS Office Ultimate 2007 for 39 Quid! An Absolute Steal!!

September 8, 2008 13:04 by Andrew Westgarth

I was recently reminded of this great offer which Microsoft have for Students, Office Ultimate 2007 is available for £38.95 which is an absolute steal!  I was reminded of this offer as my Brother is about to start a degree course at the University of Sunderland.  This is an excellent offer for any student out there!  For full details and eligibility details go to the Ultimate Steal Website this offer is also available in other countries too!

UltimateStealHeader_3

Categories: Microsoft
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Tutorial for Using ASP.Net MVC Framework on Different Versions of IIS

September 5, 2008 14:49 by Andrew Westgarth

Last night Alan Dean came up to VBUG in Newcastle to speak on ASP.Net MVC Framework.  One of the discussion points we had was any potential issues for hosting sites on IIS due to the routing and url rewrite elements of the MVC Framework.  I wasn't clear on the implications, and I hadn't seen much traffic personally on the issue.  So with a task of downloading ASP.Net MVC Framework Preview 5 so I could have a good look at it and understand it all as an alternative to Webforms, and looking into the implications and workarounds for hosting within versions of IIS I went of in search of information.

I immediately thought that with IIS7 and applications running in Integrated Mode, which is the mode I aim to run all of my applications on IIS7 in, there should be no configuration changes or modifications required since ASP.Net is part of the pipeline so all requests are processed by ASP.Net by default.  In classic mode ASP.Net requests are processed through the aspnet_isapi.dll as they would be in IIS6 so unless files are mapped to the ASP.Net Isapi filter then they wouldn't be processed.  In reading up about ASP.Net MVC on the ASP.Net website I found a great tutorial on Using ASP.NET MVC with Different Versions of IIS - hopefully this will be of help to you looking to configure and use the ASP.Net MVC Framework on IIS.

Categories: ASP.Net | How To | IIS
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Can't Save Your XSL/T File? Have You Closed Your XMLReader?

September 5, 2008 14:08 by Andrew Westgarth

Post Updated on Monday 8th September 2008 - See Below

This week I have been working on a server control for a site I'm working on which reads in an XML file containing some product information and then using an XSL/T file transforms the output into correctly formatted XHTML.  One problem which occurred with the development of the server control was that a colleague of mine who was making modifications to the XSL/T File was unable to save the changes whilst viewing the resultant XHTML in their browser.  At first hand it would appear that it would be a permissions issue, and after much checking of the permissions to confirm they were correct, it was determined this was not the issue. 

My colleague had been able to save changes to the XSL/T after a short while of the page processing which immediately pointed me to the fact that the object was still holding onto the resources.  This was further confirmed with some investigation work which I did with the help of Craig Murphy

The XMLReader object which was reading and transforming the XML using the XSL/T was still holding on to the file and placing a lock on it because the XMLReader object doesn't have a dispose method and so therefore despite my setting the object to nothing, until the garbage collector picked up the objects then the lock on the XSL/T file remained.  Craig suggested I call the XMLReader.Close() method after I had finished processing the XML, this was a method I wasn't aware of and had not seen used in any example when I did my research into the changed syntax since version 2.0 of the .Net Framework. 

Here is a code snippet below of an example of how to use the XMLReader.Close() method to release the locks on resources:

Dim strProductDataXML As String = "ProductData.xml"
Dim strProductDataXSLT As String = "ProductDataTransform.xsl"
Dim sb As New StringBuilder()
Dim sw As New StringWriter(sb)

' Create XSL CompiledTransform to hold XSLT
Dim objXSL As New XslCompiledTransform
' Create XsltSettings to hold XSLT Settings
Dim objXSLTSettings As New XsltSettings(False, True)
' Create XmlReader Object to read the XSLT
Dim objXSLReader As XmlReader
' Create XMLReaderSettings Object For XMLReader Object which will read the XSLT
Dim objXSLReaderSettings As New XmlReaderSettings()
' Create XMLSecureResolver for use with the XSLCompiledTransform
Dim objXMLResolver As New XmlSecureResolver(New XmlUrlResolver(), "http://www.mysite.com/")

'Create Reader Object to read the XSL Transform
objXSLReader = XmlReader.Create(HttpContext.Current.Server.MapPath("~/XSLT/ProductDataTransform.xsl"), objXSLReaderSettings)
' Load the Transform in the XSLCompiledTransform Object, Provide the settings and resolver objects
objXSL.Load(objXSLReader, objXSLTSettings, objXMLResolver)

' Set the Source of the ProductData XML File to be transformed
Dim xmlSource As New XmlTextReader(HttpContext.Current.Server.MapPath("~/XML/ProductData.xml"))
Dim xPathDoc As New XPathDocument(xmlSource)

' Call the close method on the XMLTextReader to release all resources which is attached too.
xmlSource.Close()

' Perform the Transformation and output it to a stringwriter object
objXSL.Transform(xPathDoc, Nothing, sw)
' Call the close method on the XSLReader to release all resources which is attached too.
objXSLReader.Close()

' Set all objects to Nothing to allow the Garbage Collector to remove them
strProductDataXML = Nothing
strProductDataXSLT = Nothing
objXSL = Nothing
objXSLTSettings = Nothing
objXSLReader = Nothing
objXSLReaderSettings = Nothing
objXMLResolver = Nothing
xmlSource = NothingxPathDoc = Nothing

' Return the transformed string
Return sb.ToString()

Now that the XMLReader is closed and has released all of the objects holding on to it, the XSL/T file can be edited and changed without having to wait for the Garbage Collector to remove the objects and release the locks.

 

UPDATE - After reading the comments I have received on this post, I have tidied up the code and made use of the Using structure, to be honest I had forgotten this was available in VB.Net from version 2.0 of the Framework.  The use of the Using structure handles the disposal of the objects and therefore releases the locks on the resources the objects are using.  Below is the updated code sample:

Dim strProductDataXML As String = "ProductData.xml"
Dim strProductDataXSLT As String = "ProductDataTransform.xsl"
Dim sb As New StringBuilder()

' Create XSL CompiledTransform to hold XSLT
Dim objXSL As New XslCompiledTransform
' Create XsltSettings to hold XSLT Settings
Dim objXSLTSettings As New XsltSettings(False, True)
' Create XMLReaderSettings Object For XMLReader Object which will read the XSLT
Dim objXSLReaderSettings As New XmlReaderSettings()
' Create XMLSecureResolver for use with the XSLCompiledTransform
Dim objXMLResolver As New XmlSecureResolver(New XmlUrlResolver(), "http://www.mysite.com")

objXSLReaderSettings.ProhibitDtd = False

'Create objXSL XMLReader Object to read the XSL Transform
Using objXSLReader As XmlReader = XmlReader.Create(HttpContext.Current.Server.MapPath("~/XSLT/" & strProductDataXSLT), objXSLReaderSettings)
    ' Load the Transform into the XSLCompiledTransform Object, Provide the settings and resolver objects    
    objXSL.Load(objXSLReader, objXSLTSettings, objXMLResolver)
    ' Set the Source of the ProductData XML File to be transformed    
    Using xmlSource As New XmlTextReader(HttpContext.Current.Server.MapPath("~/XML/" & strProductDataXML))
        Dim xPathDoc As New XPathDocument(xmlSource)
        Using sw As New StringWriter(sb)
            ' Perform the transformation and output it to a stringwriter object            
            objXSL.Transform(xPathDoc, Nothing, sw)
        End Using
    End Using
End Using

Return sb.ToString()

I'm sure you'll agree it's a lot cleaner and better structured.

Categories: How To
Actions: E-mail | Permalink | Comments (5) | Comment RSSRSS comment feed

Please Help Me Help Others - BUPA Great North Run 2008 and the Guide Dogs for the Blind

September 4, 2008 06:22 by Andrew Westgarth

On Sunday 5th October 2008 I will be taking part in the BUPA Great North Run and I am hoping to raise a sum of money to be donated to the Guide Dogs for the Blind

Why The Great North Run?

gnr_logoWhy not is my response :). It's so easy to sit at home and watch these events and say wouldn't it be great to do that! So I decided around December 2007 last year to investigate how to enter and submitted my entry form in January and paid my entrance fee, then I waited on tenterhooks to see if I got a place. Unfortunately I've had events in my life which have made me learn the very hard way that Life is Very Short and we should value every day of it. I am not hugely physical, I do play football two to three times a week but have never really been into running let alone 13.25 miles! So I looked upon the Great North Run as a challenge and something I could look back on and say I did that and at the same time hopefully help other people! I am setting myself a personal target of the time I want to achieve - if you don't have something to aim at you'll never reach the stars.   TRAINING UPDATE: I am now up to running 10 miles in one stint at a half decent pace so am well on the way to being ready :).

Why Guide Dogs for the Blind?

guide dogs blue logoWhen I looked at the long list of very worthwhile causes, I had a few milling around in my mind, with which I have had or have connections with in some form over the years, but Guide Dogs for the Blind was the one that sprung forward. Six years ago my Dad passed away, a dark and very stressful period in my life which rocked me too the core, and as part of the funeral we collected money for Guide Dogs for the Blind and just had family flowers. We chose Guide Dogs for the Blind then because my Dad always had a great love for dogs and in particular the Labradors and Retrievers which are synonymous with the Guide Dogs Organisation and so there we had a link. There were other charities we considered but we decided to help the Guide Dogs for The Blind.

Just a couple of weeks ago I was reminded of the great work that the organisation do and the amazing stories of how Guide Dogs help to change the lives of people are blind, when watching the Secret Millionaire on Channel 4. In this programme a gentleman in Glasgow had become blind after contracting a rare illness and to see how valuable his Guide Dog is and how it lets him live independently and how much love he has for the dog was very moving.  If you are in the UK I would very much recommend that you watch the program via Channel 4's online service - and you'll need to search for the Secret Millionaire - Nick Leslau.  Hopefully whatever amount I raise will be of help to the Guide Dogs for the Blind Organisation and will enable them to continue the great work that they do!  For more information about the Guide Dogs for The Blind visit their website

So how can you help me?

You can help me by sponsoring me via my JustGiving Page, and hopefully through my efforts in the Bupa Great North Run I can raise a sum of money which will be used by the Guide Dogs for the Blind to continue their great work! 

Developer Developer Developer Day 7 - Session Voting Open

September 1, 2008 06:50 by Andrew Westgarth

DDDLogo Craig Murphy via Twitter has just alerted me to the fact that session voting is now open for DDD7, go to the website now and select up to 10 sessions that you would like to see on the agenda for DDD7 - http://www.developerday.co.uk/ddd/votesessions.asp

RemixUK - Ready Steady Speak Competition! - Win an XBOX 360!

September 1, 2008 03:22 by Andrew Westgarth

Ready Steady Speak is back for the RemixUK Event in Brighton on Thursday 18th and Friday 19th of September 2008.  Are you a budding speaker? A Designer with a passion for what you do who would like to educate us Developers in how it's done or some other aspect of design which we really don't get?  Are you a Developer who wants to get his message across to designers about just how cool the latest features in Web Development Technologies are or do you just want to share your knowledge with your fellow designers and developers?  If so then Ready Steady Speak at RemixUK could be the ideal opportunity!

RemixUK is all about the conversation and the opportunity for Web Developers and Web Designers to mix and discuss their roles and technologies and work together to shape the future of the Web!.  Ready Steady Speak is a unique way for you to have a go at delivering a short presentation to a very receptive audience of like minded people, and hopefully once you get a taste you'll go on to deliver full presentations or more nugget style presentations at local usergroup events, Barcamps etc around the country!  I've presented at a number of events and conferences now and the Buzz is amazing - so I very much encourage you to have a go!  If you have any questions or doubts email me - using the contact form on this blog and I'll do everything I can to help you!

The full details of the RemixUK Ready Steady Speak Competition are:

Contestants will present a 5 min session on a subject of their choice relating to Web Development or Web Design.  They will present in front of the REMIX audience and in front of a panel of judges.  If there are more than a  certain number of contestants (TBD), there will be ‘heats’ earlier in the day with the winners of the heats in a ‘speak-off’ in the evening session.  The ‘speak-off’ will take place as stated in the evening of the first day of MIX and the first prize is an XBox 360 + Goodies! 

Prerequisites:

Mandatory

· Speakers must NOT have previously presented ‘full sessions’ at DDD, TechEd, DevWeek, SDN, SQLBITS, VBUG Conference, NxtGenUG FEST or any similar such conferences.

· Speakers must create a new session of their own with new material which can be based on existing material but cannot be a simple copy of it.

· Speakers must limit their session to as close to 5 mins as possible( overrunning time will cause the speaker to be marked down.)

· Speakers must not have previously won Speaker Idol or “Ready Steady Speak” UK Launch

· Speakers must state their desire to enter the competition by no later than COP Monday 15th September 2008 by email.

Desirable

· Speakers should provide if at all possible their own laptop, but one can be provided if necessary.  The speaker should notify the organisers of any software prerequisites.

· Speakers should have spoken previously at a User Group meeting even if only for a 10 min mini-session or ‘nugget’.  This is NOT mandatory.

 

So come on and have go it'll be a great and very rewarding experience!!!  I'm really looking forward to making the very long trip down to Brighton and look forward to meeting lots of new great people!

728x90_speaker_b

VBUG Newcastle Event: Sept 4th 08 - ASP.Net MVC Framework Preview with Alan Dean

August 11, 2008 04:41 by Andrew Westgarth

Next month sees the resumption of the VBUG Newcastle meetings and I have Alan Dean coming up to deliver a session on the ASP.Net MVC Framework Preview.  I am looking forward to Alan's visit and seeing if he can convince me about MVC as I am still not convinced - it looks too much like old asp to me :o.

Details of the session:

Alan will be providing an introduction to the new ASP.NET MVC Framework Preview and, by way of association, usage of some new .NET 3.5 features such as LINQ. The talk will cover the MVC design pattern in outline, and demonstrate usage of the ASP.NET MVC Framework itself with a simple RESTful application

Alan Dean has been a professional developer for more than a decade, primarily in the retail sector, and is currently a Senior Technologist at Charteris. An unconventional thinker, he has been involved in REST and the semantic web for 7 years. He is also a committed extreme programmer and one of the Alt.Net UK Conferences organisers.

Location: Castle Gate, Melbourne Street, Newcastle-upon-Tyne, NE1 2JQ, GB

Registration is free, please register on the VBUG website

I look forward to seeing you there!  Also I have some good sessions in the plans for Newcastle for the rest of the year.  If you are based in the North East and attend user group meetings and would like to see a topic covered, let me know and I'll see what I can do.

Categories: Events | VBUG
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

MSDN and TechNet UK Events

August 11, 2008 04:11 by Andrew Westgarth

Here are a list of forthcoming MSDN and TechNet events this autumn in the UK, unfortunately there aren't any in the North East this time as yet.

MSDN Events

TechNet Events



MCTS

Post calendar

<<  November 2024  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2024