<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Tim Mackey's Weblog - Asp.Net</title>
    <link>http://tim.mackey.ie/</link>
    <description>mostly.Net</description>
    <language>en-ie</language>
    <copyright>Tim Mackey</copyright>
    <lastBuildDate>Wed, 28 Dec 2011 21:16:30 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>tim@mackey.ie</managingEditor>
    <webMaster>tim@mackey.ie</webMaster>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=ef1b363f-dc12-4106-a797-6d2c37c7b905</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,ef1b363f-dc12-4106-a797-6d2c37c7b905.aspx</pingback:target>
      <dc:creator>Tim Mackey</dc:creator>
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,ef1b363f-dc12-4106-a797-6d2c37c7b905.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=ef1b363f-dc12-4106-a797-6d2c37c7b905</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm using Asp.Net to open excel files and
read the values cell by cell, normally i prefer to import Excel files as a datatable,
but some documents don't fit the strict rows/columns format required for importing
into a DataTable.  the code i'm using is based on <a href="http://dotnetperls.com/excel-interop">this
from dotnetperls</a>.  worked fine for the most part on my dev PC but I had a
few issues trying to get this to work on a 32bit version of excel on a 64 bit Windows
2008 server. 
<br />
here's what i had to do to get it working: 
<br /><ul><li>
disable macros (throwing exceptions opening the workbook), requires a reference to
the Microsoft.Office.Core assembly:<br />
excelApp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;  
// disable macros</li><li>
give launch / open permissions to the Excel application in DCOM config, this was tricky
because it isn't shown in a 64 bit OS if the program is 32 bit, i found <a href="http://social.technet.microsoft.com/Forums/en-US/w7itproappcompat/thread/dde69147-a01a-4eb1-8ea9-31adbf874bed/">the
answer here</a>.</li><li>
set the identity in DCOM for Excel to the interactive user.</li></ul><p><br /></p><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=ef1b363f-dc12-4106-a797-6d2c37c7b905" /></body>
      <title>Excel interop with .Net / Server 2008</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,ef1b363f-dc12-4106-a797-6d2c37c7b905.aspx</guid>
      <link>http://tim.mackey.ie/ExcelInteropWithNetServer2008.aspx</link>
      <pubDate>Wed, 28 Dec 2011 21:16:30 GMT</pubDate>
      <description>I'm using Asp.Net to open excel files and read the values cell by cell, normally i prefer to import Excel files as a datatable, but some documents don't fit the strict rows/columns format required for importing into a DataTable.&amp;nbsp; the code i'm using is based on &lt;a href="http://dotnetperls.com/excel-interop"&gt;this
from dotnetperls&lt;/a&gt;.&amp;nbsp; worked fine for the most part on my dev PC but I had a
few issues trying to get this to work on a 32bit version of excel on a 64 bit Windows
2008 server. 
&lt;br&gt;
here's what i had to do to get it working: 
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
disable macros (throwing exceptions opening the workbook), requires a reference to
the Microsoft.Office.Core assembly:&lt;br&gt;
excelApp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;&amp;nbsp;&amp;nbsp;
// disable macros&lt;/li&gt;
&lt;li&gt;
give launch / open permissions to the Excel application in DCOM config, this was tricky
because it isn't shown in a 64 bit OS if the program is 32 bit, i found &lt;a href="http://social.technet.microsoft.com/Forums/en-US/w7itproappcompat/thread/dde69147-a01a-4eb1-8ea9-31adbf874bed/"&gt;the
answer here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
set the identity in DCOM for Excel to the interactive user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=ef1b363f-dc12-4106-a797-6d2c37c7b905" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,ef1b363f-dc12-4106-a797-6d2c37c7b905.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=4e0a72af-03e6-441d-bcd5-d8ed406d5209</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,4e0a72af-03e6-441d-bcd5-d8ed406d5209.aspx</pingback:target>
      <dc:creator>Tim Mackey</dc:creator>
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,4e0a72af-03e6-441d-bcd5-d8ed406d5209.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=4e0a72af-03e6-441d-bcd5-d8ed406d5209</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Ran into a permissions problem today using <a href="http://www.codeproject.com/KB/office/fasterexcelaccesstoc.aspx">Excel
interop code</a> from within ASP.Net, which had worked fine from a windows forms application.<br />
Thanks to '<a href="http://www.mofeel.net/61-microsoft-public-dotnet-framework-interop/6941.aspx">Frosty</a>'
for his post which explains how to enable the appropriate permissions, reproducing
it here in case the link ever goes down:<br /><br /><blockquote>From command prompt / start-&gt;run... type dcomcnfg<br /><br />
Select Component Services-&gt;Computers-&gt;My Compter-&gt;DCOM Config<br /><br />
Scroll down and select Microsoft Excel Applicaton<br /><br />
Right click on Microsoft Excel Applicaton and select properties.<br /><br />
Select the Security tab<br /><br />
In Launch Permissions group box click Edit button.<br /><br />
Add the appropriate user for your particular situation. In my case, I<br />
selected MyDomainName\Domain Users.<br /><br />
Make sure that Allow check box is checked for your appropriate user.<br /><br />
Click OK<br /><br />
In Access Permissions group box click Edit button.<br /><br />
Add the appropriate user for your particular situation. In my case, I<br />
selected MyDomainName\Domain Users.<br /><br />
Make sure that Allow check box is checked for your appropriate user.<br /><br />
Click OK<br /><br />
Excel interop will now work via asp.net<br /></blockquote><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4e0a72af-03e6-441d-bcd5-d8ed406d5209" /></body>
      <title>Excel interop with Asp.Net</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,4e0a72af-03e6-441d-bcd5-d8ed406d5209.aspx</guid>
      <link>http://tim.mackey.ie/ExcelInteropWithAspNet.aspx</link>
      <pubDate>Fri, 11 Jun 2010 17:32:37 GMT</pubDate>
      <description>Ran into a permissions problem today using &lt;a href="http://www.codeproject.com/KB/office/fasterexcelaccesstoc.aspx"&gt;Excel
interop code&lt;/a&gt; from within ASP.Net, which had worked fine from a windows forms application.&lt;br&gt;
Thanks to '&lt;a href="http://www.mofeel.net/61-microsoft-public-dotnet-framework-interop/6941.aspx"&gt;Frosty&lt;/a&gt;'
for his post which explains how to enable the appropriate permissions, reproducing
it here in case the link ever goes down:&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;From command prompt / start-&amp;gt;run... type dcomcnfg&lt;br&gt;
&lt;br&gt;
Select Component Services-&amp;gt;Computers-&amp;gt;My Compter-&amp;gt;DCOM Config&lt;br&gt;
&lt;br&gt;
Scroll down and select Microsoft Excel Applicaton&lt;br&gt;
&lt;br&gt;
Right click on Microsoft Excel Applicaton and select properties.&lt;br&gt;
&lt;br&gt;
Select the Security tab&lt;br&gt;
&lt;br&gt;
In Launch Permissions group box click Edit button.&lt;br&gt;
&lt;br&gt;
Add the appropriate user for your particular situation. In my case, I&lt;br&gt;
selected MyDomainName\Domain Users.&lt;br&gt;
&lt;br&gt;
Make sure that Allow check box is checked for your appropriate user.&lt;br&gt;
&lt;br&gt;
Click OK&lt;br&gt;
&lt;br&gt;
In Access Permissions group box click Edit button.&lt;br&gt;
&lt;br&gt;
Add the appropriate user for your particular situation. In my case, I&lt;br&gt;
selected MyDomainName\Domain Users.&lt;br&gt;
&lt;br&gt;
Make sure that Allow check box is checked for your appropriate user.&lt;br&gt;
&lt;br&gt;
Click OK&lt;br&gt;
&lt;br&gt;
Excel interop will now work via asp.net&lt;br&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4e0a72af-03e6-441d-bcd5-d8ed406d5209" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,4e0a72af-03e6-441d-bcd5-d8ed406d5209.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=c947af7f-9cb4-4018-a856-c92855b04738</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,c947af7f-9cb4-4018-a856-c92855b04738.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,c947af7f-9cb4-4018-a856-c92855b04738.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=c947af7f-9cb4-4018-a856-c92855b04738</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I got a request from a client for a 'mini'
navigation menu to appear on a page to allow the user to 'jump' to the various sections
of the page.  Maintaining a set of named anchor hyperlinks in a document (with
a javascript-based select menu) is not really an option for someone who doesn't know
HTML, which is most people who use content management.  In the wrong hands this
creates more trouble than it's worth.  
<br />
so i started thinking. the documents in question are well structured, using paragraphs
and headings, as enforced by the content management system.  i worked out this
solution which is exactly what i need, a maintenance free javascript jump menu, that
doesn't add clutter to the document with named anchors.  it assumes that the
all H2 tags should be displayed as links in the menu.  the javascript iterates
through the H2 tags and loads up the menu, with a ScrollTo function used when an item
is selected.<br /><br />
here's a <a href="/content/binary/jumpmenu.png">screenshot<br /><img style="border: 1px solid rgb(0, 0, 0);" src="http://tim.mackey.ie/content/binary/jumpmenu.png" border="1" width="420" height="257" /></a><br /><br />
The code for the HTML page:<br /><pre>&lt;script src="/JumpMenu.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;select id="jumpNavSelect" name="jumpNavSelect" onchange="JumpToHeading(this.selectedIndex)"&gt;<br />
&lt;option value=""&gt;On this page...&lt;/option&gt;<br />
&lt;/select&gt;<br /></pre>and the JumpMenu.js file<br /><pre>var array;<br /><br />
function CreateAnchorMenu() {<br />
array = document.getElementsByTagName("h2"); 
<br />
var src = document.getElementById('jumpNavSelect');<br />
// iterate through all H2 headings, add dropdown items for each. 
<br />
for (var i = 0; i &lt; array.length; i++) {<br />
var heading = array[i];<br />
var text = heading.firstChild.nodeValue;<br />
if (!text)<br />
continue;<br />
src[i+1] = new Option(text, i);<br />
}<br />
}<br /><br />
function JumpToHeading(HeadingIndex) {<br />
if (HeadingIndex == 0)<br />
return;<br />
var heading = array[HeadingIndex-1];<br />
ScrollToElement(heading);<br />
}<br /><br />
function ScrollToElement(theElement) {<br />
var selectedPosX = 0;<br />
var selectedPosY = 0;<br />
while (theElement != null) {<br />
selectedPosX += theElement.offsetLeft;<br />
selectedPosY += theElement.offsetTop;<br />
theElement = theElement.offsetParent;<br />
}<br />
window.scrollTo(selectedPosX, selectedPosY);<br />
}<br /><br />
window.onload = CreateAnchorMenu;<br /></pre><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=c947af7f-9cb4-4018-a856-c92855b04738" /></body>
      <title>Javascript dynamic anchor select menu</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,c947af7f-9cb4-4018-a856-c92855b04738.aspx</guid>
      <link>http://tim.mackey.ie/JavascriptDynamicAnchorSelectMenu.aspx</link>
      <pubDate>Tue, 21 Apr 2009 12:30:58 GMT</pubDate>
      <description>I got a request from a client for a 'mini' navigation menu to appear on
a page to allow the user to 'jump' to the various sections of the
page.&amp;nbsp; Maintaining a set of named anchor hyperlinks in a document (with
a javascript-based select menu) is not really an option for someone who
doesn't know HTML, which is most people who use content management.&amp;nbsp; In
the wrong hands this creates more trouble than it's worth.&amp;nbsp; &lt;br&gt;
so i started thinking. the documents in question are well structured, using paragraphs
and headings, as enforced by the content management system.&amp;nbsp; i worked out this
solution which is exactly what i need, a maintenance free javascript jump menu, that
doesn't add clutter to the document with named anchors.&amp;nbsp; it assumes that the
all H2 tags should be displayed as links in the menu.&amp;nbsp; the javascript iterates
through the H2 tags and loads up the menu, with a ScrollTo function used when an item
is selected.&lt;br&gt;
&lt;br&gt;
here's a &lt;a href="/content/binary/jumpmenu.png"&gt;screenshot&lt;br&gt;
&lt;img style="border: 1px solid rgb(0, 0, 0);" src="http://tim.mackey.ie/content/binary/jumpmenu.png" border="1" width="420" height="257"&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
The code for the HTML page:&lt;br&gt;
&lt;pre&gt;&amp;lt;script src="/JumpMenu.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br&gt;
&amp;lt;select id="jumpNavSelect" name="jumpNavSelect" onchange="JumpToHeading(this.selectedIndex)"&amp;gt;&lt;br&gt;
&amp;lt;option value=""&amp;gt;On this page...&amp;lt;/option&amp;gt;&lt;br&gt;
&amp;lt;/select&amp;gt;&lt;br&gt;
&lt;/pre&gt;and the JumpMenu.js file&lt;br&gt;
&lt;pre&gt;var array;&lt;br&gt;
&lt;br&gt;
function CreateAnchorMenu() {&lt;br&gt;
array = document.getElementsByTagName("h2"); 
&lt;br&gt;
var src = document.getElementById('jumpNavSelect');&lt;br&gt;
// iterate through all H2 headings, add dropdown items for each. 
&lt;br&gt;
for (var i = 0; i &amp;lt; array.length; i++) {&lt;br&gt;
var heading = array[i];&lt;br&gt;
var text = heading.firstChild.nodeValue;&lt;br&gt;
if (!text)&lt;br&gt;
continue;&lt;br&gt;
src[i+1] = new Option(text, i);&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
function JumpToHeading(HeadingIndex) {&lt;br&gt;
if (HeadingIndex == 0)&lt;br&gt;
return;&lt;br&gt;
var heading = array[HeadingIndex-1];&lt;br&gt;
ScrollToElement(heading);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
function ScrollToElement(theElement) {&lt;br&gt;
var selectedPosX = 0;&lt;br&gt;
var selectedPosY = 0;&lt;br&gt;
while (theElement != null) {&lt;br&gt;
selectedPosX += theElement.offsetLeft;&lt;br&gt;
selectedPosY += theElement.offsetTop;&lt;br&gt;
theElement = theElement.offsetParent;&lt;br&gt;
}&lt;br&gt;
window.scrollTo(selectedPosX, selectedPosY);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
window.onload = CreateAnchorMenu;&lt;br&gt;
&lt;/pre&gt;&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=c947af7f-9cb4-4018-a856-c92855b04738" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,c947af7f-9cb4-4018-a856-c92855b04738.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=943b3c7e-bf3e-4047-a672-e0d2eac43c31</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,943b3c7e-bf3e-4047-a672-e0d2eac43c31.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,943b3c7e-bf3e-4047-a672-e0d2eac43c31.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=943b3c7e-bf3e-4047-a672-e0d2eac43c31</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">if your application has users who like
to log in as "JOE BLOGGS" or "joe bloggs" when their username is actually "Joe Bloggs",
you might want to ensure that they login with the correct "case" of their username. 
It can cause discrepancies if you refer to the current Identity.User in your web application,
for example if you use the username anywhere in your database and run reports grouped
on the username, you will get multiple records for each variation on the case of the
username.  It is surprisingly unintuitive to solve this problem.  Firstly
you would think that Asp.Net membership would take care of this itself.  Then
you would think that you could determine the correct case of the username as follows:<br /><pre>protected void Login1_LoggedIn(object sender, EventArgs e)<br />
{<br />
string correctUsername = Membership.GetUser(this.Login1.Username).Username;<br />
FormsAuthentication.SetAuthCookie(correctUsername , true);<br />
}<br /></pre><p>
but this doesn't work because the "Username" property of the MembershipUser object
does not collect its value from the AspNetDB SQL database like you would expect, instead
it is filled with whatever you pass it when loading the user, this must be a bug but
i'm not bothered trying to convince MS.  instead, i came up with this solution
below, to directly load the AspNetUser object from a Linq DataSource of the AspNetDb
database (created using SqlMetal).<br /></p><pre>protected void Login1_LoggedIn(object sender, EventArgs e)<br />
{<br />
// correct the case of the username<br />
string Username = this.Login1.UserName;<br />
AspNetDb db = new AspNetDb();<br />
MembershipUser memUser = Membership.GetUser(Username); // load the MembershipUser
object to get the UserID<br />
Aspnet_User aspnetUser = db.Aspnet_Users.SingleOrDefault(z =&gt; z.UserId == new Guid(memUser.ProviderUserKey.ToString()));<br />
if(aspnetUser != null)<br />
Username = aspnetUser.UserName;<br />
FormsAuthentication.SetAuthCookie(Username, true);<br />
}<br /></pre><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=943b3c7e-bf3e-4047-a672-e0d2eac43c31" /></body>
      <title>Asp.Net membership, correcting username case at login</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,943b3c7e-bf3e-4047-a672-e0d2eac43c31.aspx</guid>
      <link>http://tim.mackey.ie/AspNetMembershipCorrectingUsernameCaseAtLogin.aspx</link>
      <pubDate>Tue, 24 Mar 2009 16:38:48 GMT</pubDate>
      <description>if your application has users who like to log in as "JOE BLOGGS" or "joe bloggs" when their username is actually "Joe Bloggs", you might want to ensure that they login with the correct "case" of their username.&amp;nbsp; It can cause discrepancies if you refer to the current Identity.User in your web application, for example if you use the username anywhere in your database and run reports grouped on the username, you will get multiple records for each variation on the case of the username.&amp;nbsp; It is surprisingly unintuitive to solve this problem.&amp;nbsp; Firstly you would think that Asp.Net membership would take care of this itself.&amp;nbsp; Then you would think that you could determine the correct case of the username as follows:&lt;br&gt;
&lt;pre&gt;protected void Login1_LoggedIn(object sender, EventArgs e)&lt;br&gt;
{&lt;br&gt;
string correctUsername = Membership.GetUser(this.Login1.Username).Username;&lt;br&gt;
FormsAuthentication.SetAuthCookie(correctUsername , true);&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
but this doesn't work because the "Username" property of the MembershipUser object
does not collect its value from the AspNetDB SQL database like you would expect, instead
it is filled with whatever you pass it when loading the user, this must be a bug but
i'm not bothered trying to convince MS.&amp;nbsp; instead, i came up with this solution
below, to directly load the AspNetUser object from a Linq DataSource of the AspNetDb
database (created using SqlMetal).&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;protected void Login1_LoggedIn(object sender, EventArgs e)&lt;br&gt;
{&lt;br&gt;
// correct the case of the username&lt;br&gt;
string Username = this.Login1.UserName;&lt;br&gt;
AspNetDb db = new AspNetDb();&lt;br&gt;
MembershipUser memUser = Membership.GetUser(Username); // load the MembershipUser
object to get the UserID&lt;br&gt;
Aspnet_User aspnetUser = db.Aspnet_Users.SingleOrDefault(z =&amp;gt; z.UserId == new Guid(memUser.ProviderUserKey.ToString()));&lt;br&gt;
if(aspnetUser != null)&lt;br&gt;
Username = aspnetUser.UserName;&lt;br&gt;
FormsAuthentication.SetAuthCookie(Username, true);&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=943b3c7e-bf3e-4047-a672-e0d2eac43c31" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,943b3c7e-bf3e-4047-a672-e0d2eac43c31.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=1f65c32e-7a99-4fe1-b58c-92c8241bcc13</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,1f65c32e-7a99-4fe1-b58c-92c8241bcc13.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,1f65c32e-7a99-4fe1-b58c-92c8241bcc13.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=1f65c32e-7a99-4fe1-b58c-92c8241bcc13</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <pre>Cstr(CDate({Table.Column}), "dd/MM/yyyy")</pre>
        <p>
        </p>
        <img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=1f65c32e-7a99-4fe1-b58c-92c8241bcc13" />
      </body>
      <title>Crystal Reports date format (in code)</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,1f65c32e-7a99-4fe1-b58c-92c8241bcc13.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsDateFormatInCode.aspx</link>
      <pubDate>Fri, 27 Feb 2009 17:47:52 GMT</pubDate>
      <description>&lt;pre&gt;Cstr(CDate({Table.Column}), "dd/MM/yyyy")&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=1f65c32e-7a99-4fe1-b58c-92c8241bcc13" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,1f65c32e-7a99-4fe1-b58c-92c8241bcc13.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=779ba072-7636-496e-a71c-0f09ea71f16e</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,779ba072-7636-496e-a71c-0f09ea71f16e.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,779ba072-7636-496e-a71c-0f09ea71f16e.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=779ba072-7636-496e-a71c-0f09ea71f16e</wfw:commentRss>
      <slash:comments>10</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">today i came across a situation where a
user was spending a long time filling out a form.  they went past the session
timeout and when they hit save they got booted back to the login screen, having lost
the previous 30 minutes of work.  i looked around the net and found a few options
with AJAX and what not but it doesn't make sense to keep renewing the session automatically
otherwise you might as well not have a timeout, which is there for security reasons
anyway.  in my case i don't actually want to save the information to the database
(it's a transaction) until the user hits the Save button, i just want to keep the
session alive.  
<br /><br />
so i came up with this idea to ask the user if they want to keep their session alive
with a javascript prompt every 15 minutes. if they leave their computer and don't
answer the prompt, the session will time out since they won't have interacted with
the web site (regardless of how they answer the prompt after the timeout).  if
they answer OK to the prompt it invokes a Ping() type web service to keep the session
alive.  this is the most lightweight way i could think of doing it.  i don't
want to post back to the page because that will interrupt the user and make them wait
for the page to reload. 
<br /><br />
there are 3 parts:<br /><h3>"KeepAlive" function<br /></h3><p>
I put this function in a 'Util' class so pages can easily turn on the 'Keep Alive'
functionality, simply call <font face="Courier New">Util.KeepAlive(this);</font></p><pre>public static void KeepAlive(Page p)<br />
{<br />
p.ClientScript.RegisterClientScriptInclude("KeepAlive", "/KeepAlive.js");<br />
}</pre><h3>Ping.asmx (add the web service to your root folder)<br /></h3><pre>[WebMethod]<br />
public void Ping()<br />
{<br />
HttpContext.Current.Response.Write("OK"); 
<br />
HttpContext.Current.Response.End(); // this makes the result easier to parse than
an XML web service message<br />
}</pre><h3>KeepAlive.js (put this file in your root folder)<br /></h3><pre>var timerID = 0;	     // used to track the timer function<br />
var interval = 1000*60*15; // 15 mins<br />
var KeepAliveUrl = '/Ping.asmx/Ping'; // replace your web service address here<br />
var xmlhttpKeepAlive;<br /><br />
function AutoSaveSubmit()<br />
{<br />
if(confirm('15 minutes of idle time has passed, do you want to keep your session active?'))<br />
InvokeWebService();<br />
}<br /><br />
function InvokeWebService() 
<br />
{ 
<br />
if (window.XMLHttpRequest)<br />
{<br />
xmlhttpKeepAlive=new XMLHttpRequest();<br />
xmlhttpKeepAlive.onreadystatechange = xmlhttpChangeKeepAlive;<br />
xmlhttpKeepAlive.open('GET',KeepAliveUrl + '?T=' + timerID,true);<br />
xmlhttpKeepAlive.send(null);<br />
}<br />
// code for IE<br />
else if (window.ActiveXObject)<br />
{<br />
xmlhttpKeepAlive=new ActiveXObject('Microsoft.XMLHTTP')<br />
if (xmlhttp)<br />
{<br />
xmlhttpKeepAlive.onreadystatechange = xmlhttpChangeKeepAlive;<br />
xmlhttpKeepAlive.open('GET', KeepAliveUrl + '?T=' + timerID, true);<br />
xmlhttpKeepAlive.send();<br />
}<br />
}<br />
return false;<br />
}<br /><br />
function xmlhttpChangeKeepAlive()<br />
{<br />
var text;<br />
if (xmlhttpKeepAlive.readyState == 4) 
<br />
{<br />
text = xmlhttpKeepAlive.responseText;<br />
if (xmlhttpKeepAlive.status==200) // OK<br />
{<br />
if(text == 'OK') // reset the timer 
<br />
timerID = setTimeout('AutoSaveSubmit()', interval); 
<br />
else<br />
alert('Your session has already expired.\nIf you have any information on this page
you will lose it if you try to save this page now. You have 2 options to avoid losing
the information on this screen.\n\nOption 1: open a new internet window and log in
again to the web site, then close that window and go back to this window, at which
point you will have a new session and you will be able to save the information.\n\nOption
2: Copy all the text you have typed on this page and paste it into another program
(such as Word or Notepad), then log in to the web site again (click the home page)
and come back to this page, and paste in the text again.\n\nTo prevent this happening
in the future, click OK on the 15 minute reminder box each time it appears, this will
keep your session active. If you do not answer the reminder within 10 minutes the
session may expire.');<br />
}<br />
else<br />
alert('Error: ' + xmlhttpKeepAlive.status + '. The session may have already expired,
please try to save the page now');<br />
}<br />
}<br />
window.setTimeout('AutoSaveSubmit()',interval); 
<br /></pre><p>
You might be wondering why i append the timer code/number to the url of the web service. 
The reason is because IE has a caching bug and will not actually send the XmlHttp
request unless the URL is different to what it has in its history, it will just return
the previous result. 
<br /></p><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=779ba072-7636-496e-a71c-0f09ea71f16e" /></body>
      <title>A simple Auto-Save / Keep Alive feature for Asp.Net</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,779ba072-7636-496e-a71c-0f09ea71f16e.aspx</guid>
      <link>http://tim.mackey.ie/ASimpleAutoSaveKeepAliveFeatureForAspNet.aspx</link>
      <pubDate>Thu, 19 Feb 2009 16:18:50 GMT</pubDate>
      <description>today i came across a situation where a user was spending a long time filling out a form.&amp;nbsp; they went past the session timeout and when they hit save they got booted back to the login screen, having lost the previous 30 minutes of work.&amp;nbsp; i looked around the net and found a few options with AJAX and what not but it doesn't make sense to keep renewing the session automatically otherwise you might as well not have a timeout, which is there for security reasons anyway.&amp;nbsp; in my case i don't actually want to save the information to the database (it's a transaction) until the user hits the Save button, i just want to keep the session alive.&amp;nbsp; &lt;br&gt;
&lt;br&gt;
so i came up with this idea to ask the user if they want to keep their session alive
with a javascript prompt every 15 minutes. if they leave their computer and don't
answer the prompt, the session will time out since they won't have interacted with
the web site (regardless of how they answer the prompt after the timeout).&amp;nbsp; if
they answer OK to the prompt it invokes a Ping() type web service to keep the session
alive.&amp;nbsp; this is the most lightweight way i could think of doing it.&amp;nbsp; i don't
want to post back to the page because that will interrupt the user and make them wait
for the page to reload. 
&lt;br&gt;
&lt;br&gt;
there are 3 parts:&lt;br&gt;
&lt;h3&gt;"KeepAlive" function&lt;br&gt;
&lt;/h3&gt;
&lt;p&gt;
I put this function in a 'Util' class so pages can easily turn on the 'Keep Alive'
functionality, simply call &lt;font face="Courier New"&gt;Util.KeepAlive(this);&lt;/font&gt;
&lt;/p&gt;
&lt;pre&gt;public static void KeepAlive(Page p)&lt;br&gt;
{&lt;br&gt;
p.ClientScript.RegisterClientScriptInclude("KeepAlive", "/KeepAlive.js");&lt;br&gt;
}&lt;/pre&gt;
&lt;h3&gt;Ping.asmx (add the web service to your root folder)&lt;br&gt;
&lt;/h3&gt;
&lt;pre&gt;[WebMethod]&lt;br&gt;
public void Ping()&lt;br&gt;
{&lt;br&gt;
HttpContext.Current.Response.Write("OK"); 
&lt;br&gt;
HttpContext.Current.Response.End(); // this makes the result easier to parse than
an XML web service message&lt;br&gt;
}&lt;/pre&gt;
&lt;h3&gt;KeepAlive.js (put this file in your root folder)&lt;br&gt;
&lt;/h3&gt;
&lt;pre&gt;var timerID = 0;	     // used to track the timer function&lt;br&gt;
var interval = 1000*60*15; // 15 mins&lt;br&gt;
var KeepAliveUrl = '/Ping.asmx/Ping'; // replace your web service address here&lt;br&gt;
var xmlhttpKeepAlive;&lt;br&gt;
&lt;br&gt;
function AutoSaveSubmit()&lt;br&gt;
{&lt;br&gt;
if(confirm('15 minutes of idle time has passed, do you want to keep your session active?'))&lt;br&gt;
InvokeWebService();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
function InvokeWebService() 
&lt;br&gt;
{ 
&lt;br&gt;
if (window.XMLHttpRequest)&lt;br&gt;
{&lt;br&gt;
xmlhttpKeepAlive=new XMLHttpRequest();&lt;br&gt;
xmlhttpKeepAlive.onreadystatechange = xmlhttpChangeKeepAlive;&lt;br&gt;
xmlhttpKeepAlive.open('GET',KeepAliveUrl + '?T=' + timerID,true);&lt;br&gt;
xmlhttpKeepAlive.send(null);&lt;br&gt;
}&lt;br&gt;
// code for IE&lt;br&gt;
else if (window.ActiveXObject)&lt;br&gt;
{&lt;br&gt;
xmlhttpKeepAlive=new ActiveXObject('Microsoft.XMLHTTP')&lt;br&gt;
if (xmlhttp)&lt;br&gt;
{&lt;br&gt;
xmlhttpKeepAlive.onreadystatechange = xmlhttpChangeKeepAlive;&lt;br&gt;
xmlhttpKeepAlive.open('GET', KeepAliveUrl + '?T=' + timerID, true);&lt;br&gt;
xmlhttpKeepAlive.send();&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
return false;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
function xmlhttpChangeKeepAlive()&lt;br&gt;
{&lt;br&gt;
var text;&lt;br&gt;
if (xmlhttpKeepAlive.readyState == 4) 
&lt;br&gt;
{&lt;br&gt;
text = xmlhttpKeepAlive.responseText;&lt;br&gt;
if (xmlhttpKeepAlive.status==200) // OK&lt;br&gt;
{&lt;br&gt;
if(text == 'OK') // reset the timer 
&lt;br&gt;
timerID = setTimeout('AutoSaveSubmit()', interval); 
&lt;br&gt;
else&lt;br&gt;
alert('Your session has already expired.\nIf you have any information on this page
you will lose it if you try to save this page now. You have 2 options to avoid losing
the information on this screen.\n\nOption 1: open a new internet window and log in
again to the web site, then close that window and go back to this window, at which
point you will have a new session and you will be able to save the information.\n\nOption
2: Copy all the text you have typed on this page and paste it into another program
(such as Word or Notepad), then log in to the web site again (click the home page)
and come back to this page, and paste in the text again.\n\nTo prevent this happening
in the future, click OK on the 15 minute reminder box each time it appears, this will
keep your session active. If you do not answer the reminder within 10 minutes the
session may expire.');&lt;br&gt;
}&lt;br&gt;
else&lt;br&gt;
alert('Error: ' + xmlhttpKeepAlive.status + '. The session may have already expired,
please try to save the page now');&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
window.setTimeout('AutoSaveSubmit()',interval); 
&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
You might be wondering why i append the timer code/number to the url of the web service.&amp;nbsp;
The reason is because IE has a caching bug and will not actually send the XmlHttp
request unless the URL is different to what it has in its history, it will just return
the previous result. 
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=779ba072-7636-496e-a71c-0f09ea71f16e" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,779ba072-7636-496e-a71c-0f09ea71f16e.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=5de9f2ca-d589-4a84-9386-602f0b2a4dde</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,5de9f2ca-d589-4a84-9386-602f0b2a4dde.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,5de9f2ca-d589-4a84-9386-602f0b2a4dde.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=5de9f2ca-d589-4a84-9386-602f0b2a4dde</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">many web sites export tabular information
from grids/tables into 'Excel' format. the file is not a true Excel format and actually
contains X/HTML.  if the file is opened in Excel 2007 you may get a prompt that
the file is in a different format than specified by the file extension.  if you
regularly work with files like this, there is a way to disable this prompt, add a
DWORD key called ExtensionHardening with value 0 to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security<br />
it works straight away, no need for a reboot.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5de9f2ca-d589-4a84-9386-602f0b2a4dde" /></body>
      <title>HowTo: disable the Excel prompt for opening formats different than the extension</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,5de9f2ca-d589-4a84-9386-602f0b2a4dde.aspx</guid>
      <link>http://tim.mackey.ie/HowToDisableTheExcelPromptForOpeningFormatsDifferentThanTheExtension.aspx</link>
      <pubDate>Tue, 23 Dec 2008 12:08:07 GMT</pubDate>
      <description>many web sites export tabular information from grids/tables into 'Excel' format. the file is not a true Excel format and actually contains X/HTML.&amp;nbsp; if the file is opened in Excel 2007 you may get a prompt that the file is in a different format than specified by the file extension.&amp;nbsp; if you regularly work with files like this, there is a way to disable this prompt, add a DWORD key called ExtensionHardening with value 0 to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security&lt;br&gt;
it works straight away, no need for a reboot.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5de9f2ca-d589-4a84-9386-602f0b2a4dde" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,5de9f2ca-d589-4a84-9386-602f0b2a4dde.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">IIS went down this morning after KB 958644
was isntalled automatically last night. My sites were showing "Service Unavailable"<br />
there were several system event logs like so:<br /><ul><li>
A process serving application pool '.Net 2.0 App Pool' suffered a fatal communication
error with the World Wide Web Publishing Service. The process id was '2960'. The data
field contains the error number.</li><li>
Application pool '.Net 2.0 App Pool' is being automatically disabled due to a series
of failures in the process(es) serving that application pool.<br /></li></ul><p></p>
rebooting the server did not solve the problem.  so, on further research, <a href="http://support.microsoft.com/kb/885654">KB
article 885654</a> revealed the cause of the errors, lack of registry permissions
for NETWORK SERVICE.  i hadn't changed any configuration on the server so assumed
it was caused by a change in that windows update package.  i dug out <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx">ProcessMonitor</a> and
set up a registry filter for w3wp.exe where the Result was ACCESS DENIED.  there
were about 50 entries during the time i enabled event capture and loaded up one of
the sites that uses the affected application pool.  Most of them pointed to SystemCertificates
entries.  I went through each one in regedit and gave NETWORK SERVICE full control
where the process attempted to Create a key, and Read only access where the process
attemped to Open the key.  worked fine then. 
<br /><br />
hope this helps someone out. 
<br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3" /></body>
      <title>IIS6 Service Unavailable, after installing KB 958644</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3.aspx</guid>
      <link>http://tim.mackey.ie/IIS6ServiceUnavailableAfterInstallingKB958644.aspx</link>
      <pubDate>Sun, 26 Oct 2008 13:41:10 GMT</pubDate>
      <description>IIS went down this morning after KB 958644 was isntalled automatically last night. My sites were showing "Service Unavailable"&lt;br&gt;
there were several system event logs like so:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
A process serving application pool '.Net 2.0 App Pool' suffered a fatal communication
error with the World Wide Web Publishing Service. The process id was '2960'. The data
field contains the error number.&lt;/li&gt;
&lt;li&gt;
Application pool '.Net 2.0 App Pool' is being automatically disabled due to a series
of failures in the process(es) serving that application pool.&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
rebooting the server did not solve the problem.&amp;nbsp; so, on further research, &lt;a href="http://support.microsoft.com/kb/885654"&gt;KB
article 885654&lt;/a&gt; revealed the cause of the errors, lack of registry permissions
for NETWORK SERVICE.&amp;nbsp; i hadn't changed any configuration on the server so assumed
it was caused by a change in that windows update package.&amp;nbsp; i dug out &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx"&gt;ProcessMonitor&lt;/a&gt; and
set up a registry filter for w3wp.exe where the Result was ACCESS DENIED.&amp;nbsp; there
were about 50 entries during the time i enabled event capture and loaded up one of
the sites that uses the affected application pool.&amp;nbsp; Most of them pointed to SystemCertificates
entries.&amp;nbsp; I went through each one in regedit and gave NETWORK SERVICE full control
where the process attempted to Create a key, and Read only access where the process
attemped to Open the key.&amp;nbsp; worked fine then. 
&lt;br&gt;
&lt;br&gt;
hope this helps someone out. 
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,b37a4584-9ca3-47e0-b6c1-6d7afe5a09d3.aspx</comments>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=78885c9a-4521-45bc-9eb8-137e811914fc</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,78885c9a-4521-45bc-9eb8-137e811914fc.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,78885c9a-4521-45bc-9eb8-137e811914fc.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=78885c9a-4521-45bc-9eb8-137e811914fc</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">if you ever send a string across a web
service, and write it out to a file, make sure you specify Encoding.UTF8 explicitly.
otherwise characters such as the EURO symbol may not render correctly in some browsers
(IE6).  it took me ages to pin this down, because everything i read about was
about HTTP header charset values, or HTML document charsets, or database encodings. 
In my case i was using the default encoding and this messed up EURO symbols. I suspect
it is because of the string being serialized in the web service, but haven't the time
to look into it any further.  it's fixed now anyhow.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=78885c9a-4521-45bc-9eb8-137e811914fc" /></body>
      <title>Euro symbol character problems...</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,78885c9a-4521-45bc-9eb8-137e811914fc.aspx</guid>
      <link>http://tim.mackey.ie/EuroSymbolCharacterProblems.aspx</link>
      <pubDate>Thu, 17 Jul 2008 16:25:32 GMT</pubDate>
      <description>if you ever send a string across a web service, and write it out to a file, make sure you specify Encoding.UTF8 explicitly. otherwise characters such as the EURO symbol may not render correctly in some browsers (IE6).&amp;nbsp; it took me ages to pin this down, because everything i read about was about HTTP header charset values, or HTML document charsets, or database encodings.&amp;nbsp; In my case i was using the default encoding and this messed up EURO symbols. I suspect it is because of the string being serialized in the web service, but haven't the time to look into it any further.&amp;nbsp; it's fixed now anyhow.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=78885c9a-4521-45bc-9eb8-137e811914fc" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,78885c9a-4521-45bc-9eb8-137e811914fc.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=5d5bf00e-e298-4da6-a9fd-13710fb54836</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,5d5bf00e-e298-4da6-a9fd-13710fb54836.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,5d5bf00e-e298-4da6-a9fd-13710fb54836.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=5d5bf00e-e298-4da6-a9fd-13710fb54836</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">this wasn't very obvious to work out, and
i couldn't find a decent solution online, so i came up with this.<br /><pre>this.DropDownList1.Attributes.Add("onchange", "if(!confirm('Are you sure you want to delete this item?')) return;");<br /></pre>This works with .Net 2 and 3 and 3.5, but may break with future versions if
.Net changes the javascript code for AutoPostBack drop down lists.  The reason
it works now is because .Net adds the custom 'onchange' attribute before it's on doPostBack()
function call.  So if we return from the confirm prompt, the form will not submit.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5d5bf00e-e298-4da6-a9fd-13710fb54836" /></body>
      <title>Confirm prompt for DropDownList</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,5d5bf00e-e298-4da6-a9fd-13710fb54836.aspx</guid>
      <link>http://tim.mackey.ie/ConfirmPromptForDropDownList.aspx</link>
      <pubDate>Thu, 31 Jan 2008 16:32:13 GMT</pubDate>
      <description>this wasn't very obvious to work out, and i couldn't find a decent solution online, so i came up with this.&lt;br&gt;
&lt;pre&gt;this.DropDownList1.Attributes.Add("onchange", "if(!confirm('Are you sure you want to delete this item?')) return;");&lt;br&gt;
&lt;/pre&gt;This works with .Net 2 and 3 and 3.5, but may break with future versions if
.Net changes the javascript code for AutoPostBack drop down lists.&amp;nbsp; The reason
it works now is because .Net adds the custom 'onchange' attribute before it's on doPostBack()
function call.&amp;nbsp; So if we return from the confirm prompt, the form will not submit.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5d5bf00e-e298-4da6-a9fd-13710fb54836" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,5d5bf00e-e298-4da6-a9fd-13710fb54836.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=6fbec280-7f81-4759-a895-5a5230e00929</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,6fbec280-7f81-4759-a895-5a5230e00929.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,6fbec280-7f81-4759-a895-5a5230e00929.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=6fbec280-7f81-4759-a895-5a5230e00929</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">if, like me, you were running VS 2008 Beta
2 on a server and you had crystal reports working fine, and then recompiled your projects
in VS 2008 RTM, you may get an error like this when you try and create a crystal report
on a production server:<br /><pre>System.Runtime.InteropServices.COMException (0x800736B1):
Retrieving the COM class factory for component with CLSID
{5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error:
800736b1. at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()</pre>
In my case, i had installed Crystal Reports Runtime for VS 2008 Beta 2, and i never
installed the runtime for the RTM version.  it should be available on your VS
machine, if you opted for CR in the VS installer:<br />
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5<br /><br />
should probably uninstall the old version of the CR runtime while you're at it too.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=6fbec280-7f81-4759-a895-5a5230e00929" /></body>
      <title>Deploy Crystal Reports for VS 2008 (RTM)</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,6fbec280-7f81-4759-a895-5a5230e00929.aspx</guid>
      <link>http://tim.mackey.ie/DeployCrystalReportsForVS2008RTM.aspx</link>
      <pubDate>Tue, 27 Nov 2007 11:32:12 GMT</pubDate>
      <description>if, like me, you were running VS 2008 Beta 2 on a server and you had crystal reports working fine, and then recompiled your projects in VS 2008 RTM, you may get an error like this when you try and create a crystal report on a production server:&lt;br&gt;
&lt;pre&gt;System.Runtime.InteropServices.COMException (0x800736B1):
Retrieving the COM class factory for component with CLSID
{5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error:
800736b1. at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()&lt;/pre&gt;
In my case, i had installed Crystal Reports Runtime for VS 2008 Beta 2, and i never
installed the runtime for the RTM version.&amp;nbsp; it should be available on your VS
machine, if you opted for CR in the VS installer:&lt;br&gt;
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5&lt;br&gt;
&lt;br&gt;
should probably uninstall the old version of the CR runtime while you're at it too.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=6fbec280-7f81-4759-a895-5a5230e00929" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,6fbec280-7f81-4759-a895-5a5230e00929.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=844bcd3d-df43-4b3b-9fdc-8f86293f850e</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,844bcd3d-df43-4b3b-9fdc-8f86293f850e.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,844bcd3d-df43-4b3b-9fdc-8f86293f850e.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=844bcd3d-df43-4b3b-9fdc-8f86293f850e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h2>Note: this doesn't really work..
</h2>
        <p>
i'm just leaving it here for interest.  the approach will work for the first
invocation of either v2 or v3 client, but after a v2 client has used the web service,
any v3 clients will fail.  MS told me this is not supported because of the 2
soapExtensions interfere with each other in the pipeline etc
</p>
        <hr size="2" width="100%" />
My asp.net CMS has some winforms clients running WSE2, and i'm doing an upgrade to
the client (and server) to use WSE3, but i want to support both versions.  Both
WSE2 and WSE3 clients are using a CustomUsernameTokenManager.  it was a bit tricky
to work out, but here is what i ended up doing. thanks to brian o'keefe for his <a href="http://groups.google.com/group/microsoft.public.dotnet.framework.webservices.enhancements/browse_thread/thread/e1bed90a5b50ed2d/49fb76d46fa81b7d?lnk=gst&amp;q=version+2+3#49fb76d46fa81b7d">newsgroup
post</a> for most of the answer.  Your exact config might vary but hopefully
it will save you some of the hassle of working all this out.<br /><ul><li>
Leave the existing web service in place, e.g. Service_WSE2.asmx<br /></li><li>
Create a new web service for the WSE3 client, essentially copy/paste the ASMX file,
e.g. Service_WSE3.asmx</li><li>
Create a new CustomUsernameTokenManager for the WSE3 service which inherits from Microsoft.Web.Services3.Security.Tokens.UsernameTokenManager. 
In my case it was as easy as copy/paste from the WSE2 token manager and change all
the WSE2 namespaces to WSE3.<br /></li><li>
then in web.config, make sure both WSE config sections are listed:<br /><pre>&lt;configuration&gt;<br />
&lt;configSections&gt;<br />
&lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3,Version=3.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;/configSections&gt;<br /></pre></li><li><p>
add in references to both the assemblies for the compilation section (not 100% sure
if this is necessary, but at least it means the app will not compile on the production
server if you forget to deploy either of the WSE assemblies, instead of waiting till
one of your clients connects).<br /></p><pre>	&lt;compilation defaultLanguage="c#" debug="true"&gt;<br />
&lt;assemblies&gt;<br />
&lt;add assembly="Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;<br />
&lt;add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;</pre></li><li><p>
remove the &lt;webServices&gt; section from &lt;system.web&gt;, because each web service
should be configured by location, not global as this interferes.<br /></p><pre>	&lt;location path="Service_WSE2.asmx"&gt;<br />
&lt;system.web&gt;<br />
&lt;webServices&gt;<br />
&lt;soapExtensionTypes&gt;<br />
&lt;add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0"
/&gt;<br />
&lt;/soapExtensionTypes&gt; 
<br />
&lt;/webServices&gt;<br />
&lt;/system.web&gt;<br />
&lt;/location&gt;<br /><br />
&lt;location path="Service_WSE3.asmx"&gt;<br />
&lt;system.web&gt;<br />
&lt;webServices&gt;<br />
&lt;soapExtensionTypes&gt;<br />
&lt;clear/&gt;<br />
&lt;/soapExtensionTypes&gt;<br />
&lt;soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;<br />
&lt;soapExtensionImporterTypes&gt;<br />
&lt;add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;<br />
&lt;/soapExtensionImporterTypes&gt; 
<br />
&lt;/webServices&gt;<br />
&lt;/system.web&gt;<br />
&lt;/location&gt;</pre></li><li>
my webservice policy are defined in policyCache.config files, so the following web.config
sections point each version of WSE to the right file:<br /><pre>	&lt;microsoft.web.services3&gt;<br />
&lt;policy fileName="policyCache_WSE3.config"/&gt;<br />
&lt;security&gt;<br />
&lt;securityTokenManager&gt;<br />
&lt;add type="Whatever.CustomUsernameTokenManager3" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
localName="UsernameToken"/&gt;<br />
&lt;/securityTokenManager&gt;<br />
&lt;/security&gt;<br />
&lt;/microsoft.web.services3&gt;<br />
&lt;microsoft.web.services2&gt;<br />
&lt;messaging&gt;<br />
&lt;maxRequestLength&gt;10000&lt;/maxRequestLength&gt;<br />
&lt;/messaging&gt;<br />
&lt;security&gt;<br />
&lt;securityTokenManager type="Whatever.CustomUsernameTokenManager2, MyAssemblyName"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"<br />
qname="wsse:UsernameToken" /&gt;<br />
&lt;defaultTtlInSeconds&gt;86400&lt;/defaultTtlInSeconds&gt;<br />
&lt;timeToleranceInSeconds&gt;86400&lt;/timeToleranceInSeconds&gt;<br />
&lt;/security&gt;<br />
&lt;policy&gt;<br />
&lt;cache name="policyCache_WSE2.config" /&gt;<br />
&lt;/policy&gt;<br />
&lt;/microsoft.web.services2&gt;</pre></li><li>
and lastly, the policy cache files themselves:<br />
WSE 3 version<br /><pre>&lt;?xml version="1.0"?&gt;<br />
&lt;policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy"&gt;<br />
&lt;extensions&gt;<br />
&lt;extension name="usernameOverTransportSecurity" type="Microsoft.Web.Services3.Design.UsernameOverTransportAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;extension name="requireActionHeader" type="Microsoft.Web.Services3.Design.RequireActionHeaderAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;/extensions&gt;<br />
&lt;policy name="usernameTokenSecurity"&gt; 
<br />
&lt;usernameOverTransportSecurity /&gt;<br />
&lt;requireActionHeader /&gt;<br />
&lt;/policy&gt;<br />
&lt;/policies&gt;</pre></li><li>
WSE 2 version<br /><pre>&lt;?xml version="1.0"?&gt;<br />
&lt;policyDocument xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy" xmlns="http://schemas.microsoft.com/wse/2003/06/Policy"&gt;<br />
&lt;mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"&gt;<br /><br />
&lt;endpoint uri="http://localhost/Service_WSE2.asmx"&gt;<br />
&lt;defaultOperation&gt;<br />
&lt;request policy="#username-token-signed" /&gt;<br />
&lt;response policy="" /&gt;<br />
&lt;fault policy="" /&gt;<br />
&lt;/defaultOperation&gt;<br />
&lt;/endpoint&gt;<br /><br />
&lt;defaultEndpoint&gt;<br />
&lt;defaultOperation&gt;<br />
&lt;request policy="" /&gt;<br />
&lt;response policy="" /&gt;<br />
&lt;fault policy="" /&gt;<br />
&lt;/defaultOperation&gt;<br />
&lt;/defaultEndpoint&gt;<br /><br />
&lt;/mappings&gt;<br />
&lt;policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;<br />
&lt;wsp:Policy wsu:Id="username-token-signed" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"&gt;<br />
&lt;wsp:MessagePredicate wsp:Usage="wsp:Required" Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part"&gt;<br />
wsp:Body() wsp:Header(wsa:To) wsp:Header(wsa:Action) wsp:Header(wsa:MessageID) wse:Timestamp()<br />
&lt;/wsp:MessagePredicate&gt;<br />
&lt;wssp:Integrity wsp:Usage="wsp:Required"&gt;<br />
&lt;wssp:TokenInfo&gt;<br />
&lt;SecurityToken xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"&gt;<br />
&lt;wssp:TokenType&gt;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken&lt;/wssp:TokenType&gt;<br />
&lt;wssp:Claims&gt;<br />
&lt;wssp:UsePassword wsp:Usage="wsp:Required" /&gt;<br />
&lt;/wssp:Claims&gt;<br />
&lt;/SecurityToken&gt;<br />
&lt;/wssp:TokenInfo&gt;<br />
&lt;wssp:MessageParts Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part"&gt;<br />
wsp:Body() wsp:Header(wsa:Action) wsp:Header(wsa:FaultTo) wsp:Header(wsa:From) wsp:Header(wsa:MessageID)
wsp:Header(wsa:RelatesTo) wsp:Header(wsa:ReplyTo) wsp:Header(wsa:To) wse:Timestamp()<br />
&lt;/wssp:MessageParts&gt;<br />
&lt;/wssp:Integrity&gt;<br />
&lt;/wsp:Policy&gt;<br />
&lt;/policies&gt;<br />
&lt;/policyDocument&gt;<br /></pre></li></ul><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=844bcd3d-df43-4b3b-9fdc-8f86293f850e" /></body>
      <title>Running WSE 2 and 3 side by side</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,844bcd3d-df43-4b3b-9fdc-8f86293f850e.aspx</guid>
      <link>http://tim.mackey.ie/RunningWSE2And3SideBySide.aspx</link>
      <pubDate>Fri, 16 Nov 2007 12:16:50 GMT</pubDate>
      <description>&lt;h2&gt;Note: this doesn't really work..
&lt;/h2&gt;
&lt;p&gt;
i'm just leaving it here for interest.&amp;nbsp; the approach will work for the first
invocation of either v2 or v3 client, but after a v2 client has used the web service,
any v3 clients will fail.&amp;nbsp; MS told me this is not supported because of the 2
soapExtensions interfere with each other in the pipeline etc
&lt;/p&gt;
&lt;hr size="2" width="100%"&gt;
My asp.net CMS has some winforms clients running WSE2, and i'm doing an upgrade to
the client (and server) to use WSE3, but i want to support both versions.&amp;nbsp; Both
WSE2 and WSE3 clients are using a CustomUsernameTokenManager.&amp;nbsp; it was a bit tricky
to work out, but here is what i ended up doing. thanks to brian o'keefe for his &lt;a href="http://groups.google.com/group/microsoft.public.dotnet.framework.webservices.enhancements/browse_thread/thread/e1bed90a5b50ed2d/49fb76d46fa81b7d?lnk=gst&amp;amp;q=version+2+3#49fb76d46fa81b7d"&gt;newsgroup
post&lt;/a&gt; for most of the answer.&amp;nbsp; Your exact config might vary but hopefully
it will save you some of the hassle of working all this out.&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
Leave the existing web service in place, e.g. Service_WSE2.asmx&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
Create a new web service for the WSE3 client, essentially copy/paste the ASMX file,
e.g. Service_WSE3.asmx&lt;/li&gt;
&lt;li&gt;
Create a new CustomUsernameTokenManager for the WSE3 service which inherits from Microsoft.Web.Services3.Security.Tokens.UsernameTokenManager.&amp;nbsp;
In my case it was as easy as copy/paste from the WSE2 token manager and change all
the WSE2 namespaces to WSE3.&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
then in web.config, make sure both WSE config sections are listed:&lt;br&gt;
&lt;pre&gt;&amp;lt;configuration&amp;gt;&lt;br&gt;
&amp;lt;configSections&amp;gt;&lt;br&gt;
&amp;lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3,Version=3.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;/configSections&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
add in references to both the assemblies for the compilation section (not 100% sure
if this is necessary, but at least it means the app will not compile on the production
server if you forget to deploy either of the WSE assemblies, instead of waiting till
one of your clients connects).&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;	&amp;lt;compilation defaultLanguage="c#" debug="true"&amp;gt;&lt;br&gt;
&amp;lt;assemblies&amp;gt;&lt;br&gt;
&amp;lt;add assembly="Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&amp;gt;&lt;br&gt;
&amp;lt;add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&amp;gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
remove the &amp;lt;webServices&amp;gt; section from &amp;lt;system.web&amp;gt;, because each web service
should be configured by location, not global as this interferes.&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;	&amp;lt;location path="Service_WSE2.asmx"&amp;gt;&lt;br&gt;
&amp;lt;system.web&amp;gt;&lt;br&gt;
&amp;lt;webServices&amp;gt;&lt;br&gt;
&amp;lt;soapExtensionTypes&amp;gt;&lt;br&gt;
&amp;lt;add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0"
/&amp;gt;&lt;br&gt;
&amp;lt;/soapExtensionTypes&amp;gt; 
&lt;br&gt;
&amp;lt;/webServices&amp;gt;&lt;br&gt;
&amp;lt;/system.web&amp;gt;&lt;br&gt;
&amp;lt;/location&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;location path="Service_WSE3.asmx"&amp;gt;&lt;br&gt;
&amp;lt;system.web&amp;gt;&lt;br&gt;
&amp;lt;webServices&amp;gt;&lt;br&gt;
&amp;lt;soapExtensionTypes&amp;gt;&lt;br&gt;
&amp;lt;clear/&amp;gt;&lt;br&gt;
&amp;lt;/soapExtensionTypes&amp;gt;&lt;br&gt;
&amp;lt;soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&amp;gt;&lt;br&gt;
&amp;lt;soapExtensionImporterTypes&amp;gt;&lt;br&gt;
&amp;lt;add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&amp;gt;&lt;br&gt;
&amp;lt;/soapExtensionImporterTypes&amp;gt; 
&lt;br&gt;
&amp;lt;/webServices&amp;gt;&lt;br&gt;
&amp;lt;/system.web&amp;gt;&lt;br&gt;
&amp;lt;/location&amp;gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
my webservice policy are defined in policyCache.config files, so the following web.config
sections point each version of WSE to the right file:&lt;br&gt;
&lt;pre&gt;	&amp;lt;microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;policy fileName="policyCache_WSE3.config"/&amp;gt;&lt;br&gt;
&amp;lt;security&amp;gt;&lt;br&gt;
&amp;lt;securityTokenManager&amp;gt;&lt;br&gt;
&amp;lt;add type="Whatever.CustomUsernameTokenManager3" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
localName="UsernameToken"/&amp;gt;&lt;br&gt;
&amp;lt;/securityTokenManager&amp;gt;&lt;br&gt;
&amp;lt;/security&amp;gt;&lt;br&gt;
&amp;lt;/microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;microsoft.web.services2&amp;gt;&lt;br&gt;
&amp;lt;messaging&amp;gt;&lt;br&gt;
&amp;lt;maxRequestLength&amp;gt;10000&amp;lt;/maxRequestLength&amp;gt;&lt;br&gt;
&amp;lt;/messaging&amp;gt;&lt;br&gt;
&amp;lt;security&amp;gt;&lt;br&gt;
&amp;lt;securityTokenManager type="Whatever.CustomUsernameTokenManager2, MyAssemblyName"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&lt;br&gt;
qname="wsse:UsernameToken" /&amp;gt;&lt;br&gt;
&amp;lt;defaultTtlInSeconds&amp;gt;86400&amp;lt;/defaultTtlInSeconds&amp;gt;&lt;br&gt;
&amp;lt;timeToleranceInSeconds&amp;gt;86400&amp;lt;/timeToleranceInSeconds&amp;gt;&lt;br&gt;
&amp;lt;/security&amp;gt;&lt;br&gt;
&amp;lt;policy&amp;gt;&lt;br&gt;
&amp;lt;cache name="policyCache_WSE2.config" /&amp;gt;&lt;br&gt;
&amp;lt;/policy&amp;gt;&lt;br&gt;
&amp;lt;/microsoft.web.services2&amp;gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
and lastly, the policy cache files themselves:&lt;br&gt;
WSE 3 version&lt;br&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy"&amp;gt;&lt;br&gt;
&amp;lt;extensions&amp;gt;&lt;br&gt;
&amp;lt;extension name="usernameOverTransportSecurity" type="Microsoft.Web.Services3.Design.UsernameOverTransportAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;extension name="requireActionHeader" type="Microsoft.Web.Services3.Design.RequireActionHeaderAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;/extensions&amp;gt;&lt;br&gt;
&amp;lt;policy name="usernameTokenSecurity"&amp;gt; 
&lt;br&gt;
&amp;lt;usernameOverTransportSecurity /&amp;gt;&lt;br&gt;
&amp;lt;requireActionHeader /&amp;gt;&lt;br&gt;
&amp;lt;/policy&amp;gt;&lt;br&gt;
&amp;lt;/policies&amp;gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
WSE 2 version&lt;br&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;policyDocument xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy" xmlns="http://schemas.microsoft.com/wse/2003/06/Policy"&amp;gt;&lt;br&gt;
&amp;lt;mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy"&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;endpoint uri="http://localhost/Service_WSE2.asmx"&amp;gt;&lt;br&gt;
&amp;lt;defaultOperation&amp;gt;&lt;br&gt;
&amp;lt;request policy="#username-token-signed" /&amp;gt;&lt;br&gt;
&amp;lt;response policy="" /&amp;gt;&lt;br&gt;
&amp;lt;fault policy="" /&amp;gt;&lt;br&gt;
&amp;lt;/defaultOperation&amp;gt;&lt;br&gt;
&amp;lt;/endpoint&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;defaultEndpoint&amp;gt;&lt;br&gt;
&amp;lt;defaultOperation&amp;gt;&lt;br&gt;
&amp;lt;request policy="" /&amp;gt;&lt;br&gt;
&amp;lt;response policy="" /&amp;gt;&lt;br&gt;
&amp;lt;fault policy="" /&amp;gt;&lt;br&gt;
&amp;lt;/defaultOperation&amp;gt;&lt;br&gt;
&amp;lt;/defaultEndpoint&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;/mappings&amp;gt;&lt;br&gt;
&amp;lt;policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&amp;gt;&lt;br&gt;
&amp;lt;wsp:Policy wsu:Id="username-token-signed" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"&amp;gt;&lt;br&gt;
&amp;lt;wsp:MessagePredicate wsp:Usage="wsp:Required" Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part"&amp;gt;&lt;br&gt;
wsp:Body() wsp:Header(wsa:To) wsp:Header(wsa:Action) wsp:Header(wsa:MessageID) wse:Timestamp()&lt;br&gt;
&amp;lt;/wsp:MessagePredicate&amp;gt;&lt;br&gt;
&amp;lt;wssp:Integrity wsp:Usage="wsp:Required"&amp;gt;&lt;br&gt;
&amp;lt;wssp:TokenInfo&amp;gt;&lt;br&gt;
&amp;lt;SecurityToken xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext"&amp;gt;&lt;br&gt;
&amp;lt;wssp:TokenType&amp;gt;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken&amp;lt;/wssp:TokenType&amp;gt;&lt;br&gt;
&amp;lt;wssp:Claims&amp;gt;&lt;br&gt;
&amp;lt;wssp:UsePassword wsp:Usage="wsp:Required" /&amp;gt;&lt;br&gt;
&amp;lt;/wssp:Claims&amp;gt;&lt;br&gt;
&amp;lt;/SecurityToken&amp;gt;&lt;br&gt;
&amp;lt;/wssp:TokenInfo&amp;gt;&lt;br&gt;
&amp;lt;wssp:MessageParts Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part"&amp;gt;&lt;br&gt;
wsp:Body() wsp:Header(wsa:Action) wsp:Header(wsa:FaultTo) wsp:Header(wsa:From) wsp:Header(wsa:MessageID)
wsp:Header(wsa:RelatesTo) wsp:Header(wsa:ReplyTo) wsp:Header(wsa:To) wse:Timestamp()&lt;br&gt;
&amp;lt;/wssp:MessageParts&amp;gt;&lt;br&gt;
&amp;lt;/wssp:Integrity&amp;gt;&lt;br&gt;
&amp;lt;/wsp:Policy&amp;gt;&lt;br&gt;
&amp;lt;/policies&amp;gt;&lt;br&gt;
&amp;lt;/policyDocument&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=844bcd3d-df43-4b3b-9fdc-8f86293f850e" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,844bcd3d-df43-4b3b-9fdc-8f86293f850e.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=dd18de04-8ed1-4640-975a-e120ed746b86</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,dd18de04-8ed1-4640-975a-e120ed746b86.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,dd18de04-8ed1-4640-975a-e120ed746b86.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=dd18de04-8ed1-4640-975a-e120ed746b86</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Here is the sql that is generated by a
DataContext when you use Skip() and Take() to efficiently select records for the grid:<br /><pre>SELECT TOP 10 [t1].[Name], [t1].[Address], [t1].[Tel1], [t1].[Tel2], [t1].[Email], [t1].[DateCommenced], [t1].[Comments], [t1].[Active], [t1].[Fax]<br />
FROM (<br />
SELECT ROW_NUMBER() OVER (ORDER BY [t0].[Name], [t0].[Address], [t0].[Tel1], [t0].[Tel2],
[t0].[Email], [t0].[DateCommenced], [t0].[Comments], [t0].[Active], [t0].[Fax]) AS
[ROW_NUMBER], [t0].[Name], [t0].[Address], [t0].[Tel1], [t0].[Tel2], [t0].[Email],
[t0].[DateCommenced], [t0].[Comments], [t0].[Active], [t0].[Fax]<br />
FROM [dbo].[Table1] AS [t0]<br />
) AS [t1]<br />
WHERE [t1].[ROW_NUMBER] &gt; @p0<br />
-- @p0: Input Int32 (Size = 0; Prec = 0; Scale = 0) [50]<br />
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1<br /></pre><p>
it's not immediately obvious why they use the subquery like this, but i'm sure they
have been very thorough in optimising LINQ.  
<br /></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=dd18de04-8ed1-4640-975a-e120ed746b86" /></body>
      <title>LINQ Sql Using Skip And Take</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,dd18de04-8ed1-4640-975a-e120ed746b86.aspx</guid>
      <link>http://tim.mackey.ie/LINQSqlUsingSkipAndTake.aspx</link>
      <pubDate>Tue, 18 Sep 2007 12:22:32 GMT</pubDate>
      <description>Here is the sql that is generated by a DataContext when you use Skip() and Take() to efficiently select records for the grid:&lt;br&gt;
&lt;pre&gt;SELECT TOP 10 [t1].[Name], [t1].[Address], [t1].[Tel1], [t1].[Tel2], [t1].[Email], [t1].[DateCommenced], [t1].[Comments], [t1].[Active], [t1].[Fax]&lt;br&gt;
FROM (&lt;br&gt;
SELECT ROW_NUMBER() OVER (ORDER BY [t0].[Name], [t0].[Address], [t0].[Tel1], [t0].[Tel2],
[t0].[Email], [t0].[DateCommenced], [t0].[Comments], [t0].[Active], [t0].[Fax]) AS
[ROW_NUMBER], [t0].[Name], [t0].[Address], [t0].[Tel1], [t0].[Tel2], [t0].[Email],
[t0].[DateCommenced], [t0].[Comments], [t0].[Active], [t0].[Fax]&lt;br&gt;
FROM [dbo].[Table1] AS [t0]&lt;br&gt;
) AS [t1]&lt;br&gt;
WHERE [t1].[ROW_NUMBER] &amp;gt; @p0&lt;br&gt;
-- @p0: Input Int32 (Size = 0; Prec = 0; Scale = 0) [50]&lt;br&gt;
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
it's not immediately obvious why they use the subquery like this, but i'm sure they
have been very thorough in optimising LINQ.&amp;nbsp; 
&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=dd18de04-8ed1-4640-975a-e120ed746b86" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,dd18de04-8ed1-4640-975a-e120ed746b86.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=0bdadf0f-ab25-4589-aa67-35cca88354e7</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,0bdadf0f-ab25-4589-aa67-35cca88354e7.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,0bdadf0f-ab25-4589-aa67-35cca88354e7.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=0bdadf0f-ab25-4589-aa67-35cca88354e7</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i couldn't figure out why IE was giving
me an 'invalid argument' for using code like: 
<br /><pre>window.open("http://whatever", "1234321-ABCDE-1234231");</pre>the problem is
that IE only accepts alphanumeric and underscore characters for the second parameter
(window name), so the hyphens were causing problems.  just trim them out and
it will work fine.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0bdadf0f-ab25-4589-aa67-35cca88354e7" /></body>
      <title>IE problems with javascript window.open()</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,0bdadf0f-ab25-4589-aa67-35cca88354e7.aspx</guid>
      <link>http://tim.mackey.ie/IEProblemsWithJavascriptWindowopen.aspx</link>
      <pubDate>Wed, 29 Aug 2007 12:34:31 GMT</pubDate>
      <description>i couldn't figure out why IE was giving me an 'invalid argument' for using code like: &lt;br&gt;
&lt;pre&gt;window.open("http://whatever", "1234321-ABCDE-1234231");&lt;/pre&gt;the problem is
that IE only accepts alphanumeric and underscore characters for the second parameter
(window name), so the hyphens were causing problems.&amp;nbsp; just trim them out and
it will work fine.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0bdadf0f-ab25-4589-aa67-35cca88354e7" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,0bdadf0f-ab25-4589-aa67-35cca88354e7.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=f4d85eae-48dc-4298-9098-d7d365b48d8f</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,f4d85eae-48dc-4298-9098-d7d365b48d8f.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,f4d85eae-48dc-4298-9098-d7d365b48d8f.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=f4d85eae-48dc-4298-9098-d7d365b48d8f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Just got up and running with VS 2008 Beta
2 and converted my Orcas Beta 1 projects over to VS 2008.  have a read of <a href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx">Scott
Gu's post</a> on downloading and installing.  whaddya know? VS 2008 hasn't crashed
yet :)  seriously though, this is a major relief to see good stability. 
as a developer it did my head in to have to keep nuking devenv.exe and losing a few
minutes work, driving me quietly insane.  hopefully those days are over now. 
Beta 1 was a thousand times better than VS 2005, but Beta 2 looks even better.  
<br /><br />
in terms of breaking changes with upgrading projects etc., here are some tidbits i
came across<br /><ul><li>
the namespace <font color="#008000" face="Courier New"><b>System.Data.Linq.Expressions</b></font> no
longer exists.  i just deleted this namespace and it worked fine, they must have
moved various classes back into the root Linq namespace or something.</li><li>
if you use SqlMetal, you will have to use the new version of this tool, which i found
at <b><font color="#008000" face="Courier New">C:\Program Files\Microsoft SDKs\Windows\V6.0A\Bin\SqlMetal.exe</font></b>.
The generated code from the new tool is very different to before so you will need
to regenerate in order to use the new LINQ libraries.<br /></li><li><font color="#008000" face="Courier New"><b>web.config</b></font> changes are also
introduced.  the best way to figure out the changes is to open up a blank web
application and compare the standard web.config in the empty project to your own web.config.</li><li>
Crystal Reports assembly version numbers are the same with this release of VS, 10.5.3700.0,
so no changes here since Beta1.</li></ul>
i'll post more next week when i have some real experience using VS 2008.  so
far so good.  great job Scott &amp; Co.<br /><p></p><h5>Update 30 July 2007 - Deployment Issues<br /></h5><ul><li>
To deploy a VS 2008 beta 2 web application to a Server 2003 with .net runtime 2.0,
you need to install 3.5 of the runtime.  i got all sorts of web.config errors
due to the new syntax with beta 2.  A web app compiled against v3.5 in Beta 1
had no trouble running on top of the 2.0 runtime with the various v3.5 DLLs deployed
to the /bin directory, however this doesn't seem to be possible anymore.  it
took me a while to find the correct download for the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D2F74873-C796-4E60-91C8-F0EF809B09EE&amp;displaylang=en">3.5
beta 2 redistributable</a>, it installed in about 10 mins and required a reboot, and
did not affect any of the v1.1 and v2 web sites running on the server.  
<br /></li></ul><br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=f4d85eae-48dc-4298-9098-d7d365b48d8f" /></body>
      <title>VS 2008: First impressions</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,f4d85eae-48dc-4298-9098-d7d365b48d8f.aspx</guid>
      <link>http://tim.mackey.ie/VS2008FirstImpressions.aspx</link>
      <pubDate>Fri, 27 Jul 2007 16:49:16 GMT</pubDate>
      <description>Just got up and running with VS 2008 Beta 2 and converted my Orcas Beta 1 projects over to VS 2008.&amp;nbsp; have a read of &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/26/vs-2008-and-net-3-5-beta-2-released.aspx"&gt;Scott
Gu's post&lt;/a&gt; on downloading and installing.&amp;nbsp; whaddya know? VS 2008 hasn't crashed
yet :)&amp;nbsp; seriously though, this is a major relief to see good stability.&amp;nbsp;
as a developer it did my head in to have to keep nuking devenv.exe and losing a few
minutes work, driving me quietly insane.&amp;nbsp; hopefully those days are over now.&amp;nbsp;
Beta 1 was a thousand times better than VS 2005, but Beta 2 looks even better.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
in terms of breaking changes with upgrading projects etc., here are some tidbits i
came across&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
the namespace &lt;font color="#008000" face="Courier New"&gt;&lt;b&gt;System.Data.Linq.Expressions&lt;/b&gt;&lt;/font&gt; no
longer exists.&amp;nbsp; i just deleted this namespace and it worked fine, they must have
moved various classes back into the root Linq namespace or something.&lt;/li&gt;
&lt;li&gt;
if you use SqlMetal, you will have to use the new version of this tool, which i found
at &lt;b&gt;&lt;font color="#008000" face="Courier New"&gt;C:\Program Files\Microsoft SDKs\Windows\V6.0A\Bin\SqlMetal.exe&lt;/font&gt;&lt;/b&gt;.
The generated code from the new tool is very different to before so you will need
to regenerate in order to use the new LINQ libraries.&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;font color="#008000" face="Courier New"&gt;&lt;b&gt;web.config&lt;/b&gt;&lt;/font&gt; changes are also
introduced.&amp;nbsp; the best way to figure out the changes is to open up a blank web
application and compare the standard web.config in the empty project to your own web.config.&lt;/li&gt;
&lt;li&gt;
Crystal Reports assembly version numbers are the same with this release of VS, 10.5.3700.0,
so no changes here since Beta1.&lt;/li&gt;
&lt;/ul&gt;
i'll post more next week when i have some real experience using VS 2008.&amp;nbsp; so
far so good.&amp;nbsp; great job Scott &amp;amp; Co.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;h5&gt;Update 30 July 2007 - Deployment Issues&lt;br&gt;
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
To deploy a VS 2008 beta 2 web application to a Server 2003 with .net runtime 2.0,
you need to install 3.5 of the runtime.&amp;nbsp; i got all sorts of web.config errors
due to the new syntax with beta 2.&amp;nbsp; A web app compiled against v3.5 in Beta 1
had no trouble running on top of the 2.0 runtime with the various v3.5 DLLs deployed
to the /bin directory, however this doesn't seem to be possible anymore.&amp;nbsp; it
took me a while to find the correct download for the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D2F74873-C796-4E60-91C8-F0EF809B09EE&amp;amp;displaylang=en"&gt;3.5
beta 2 redistributable&lt;/a&gt;, it installed in about 10 mins and required a reboot, and
did not affect any of the v1.1 and v2 web sites running on the server.&amp;nbsp; 
&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=f4d85eae-48dc-4298-9098-d7d365b48d8f" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,f4d85eae-48dc-4298-9098-d7d365b48d8f.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=876f74bb-586f-402e-acd6-ba3c000e5ce9</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,876f74bb-586f-402e-acd6-ba3c000e5ce9.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,876f74bb-586f-402e-acd6-ba3c000e5ce9.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=876f74bb-586f-402e-acd6-ba3c000e5ce9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">this is a bit of a strange one.  I
have a table and it has approx 60 columns, with only one row being shown.  I
wanted a human-readable display of all the fields in the table for any given row,
i.e. i didn't want the user to have to scroll several screens across just to read
the data for a single row.  Vertical scrolling is obviously easier, so i wrote
a Repeater implementation, which works nicely.  For a table with X columns and
Y rows, the output will have X rows and Y columns.  Screenshot below shows the
output of all the ServerVariables in a HTTP-request, which is a good example of a
datasource that does not naturally fit the traditional 'grid' display.<br /><pre>&lt;!-- ASPX usage --&gt;<br />
&lt;xyz:VerticalGrid ID="vGrid" runat="server" /&gt;<br /><br />
// sample databinding...<br />
this.vGrid1.DataSource = new DataView(dataSet1.Tables[0]);<br />
this.vGrid1.DataBind();<br /><br />
/// &lt;summary&gt;<br />
/// A Repeater control that shows the rows and columns inverted. 
<br />
/// No template is required for the items.<br />
/// The datasource must be an ADO.Net DataView<br />
/// &lt;/summary&gt;<br />
[ToolboxData("&lt;{0}:VerticalGrid runat=server&gt;&lt;/{0}:VerticalGrid&gt;")]<br />
public class VerticalGrid : Repeater<br />
{<br />
public VerticalGrid()<br />
{<br />
this.EnableViewState = false;<br />
}<br /><br />
protected override void Render(HtmlTextWriter writer)<br />
{<br />
// invert the rows and cols<br />
if (!(base.DataSource is DataView))<br />
throw new Exception("Error: only a dataview datasource can be used");<br /><br />
DataView dv = base.DataSource as DataView;<br /><br />
// output start of table<br />
writer.Write("\n&lt;table class='grid'&gt;");<br /><br />
// output each row<br />
for (int i = 0; i &lt; dv.Table.Columns.Count; i++)<br />
{<br />
writer.Write("\n&lt;tr class='{0}'&gt;&lt;th&gt;{1}&lt;/th&gt;", i % 2 == 1 ? "gI"
: "gA", dv.Table.Columns[i].ColumnName); // output the column name in the first cell.
class names gI and gA are abbreviations of gridItem gridAlternatingItem, to reduce
output markup.<br />
for (int j = 0; j &lt; dv.Count; j++)<br />
writer.Write("&lt;td&gt;{0}&lt;/td&gt;", dv[j].Row.IsNull(i) ? "&amp;nbsp;" : dv[j][i].ToString());<br />
writer.Write("&lt;/tr&gt;");<br />
}<br />
writer.Write("\n&lt;/table&gt;");<br />
}<br />
}<br /></pre><p></p><img src="http://tim.mackey.ie/content/binary/vGrid.jpg" border="0" /><br /><br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=876f74bb-586f-402e-acd6-ba3c000e5ce9" /></body>
      <title>HowTo: Invert datagrid rows and columns</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,876f74bb-586f-402e-acd6-ba3c000e5ce9.aspx</guid>
      <link>http://tim.mackey.ie/HowToInvertDatagridRowsAndColumns.aspx</link>
      <pubDate>Thu, 05 Jul 2007 14:53:40 GMT</pubDate>
      <description>this is a bit of a strange one.&amp;nbsp; I have a table and it has approx 60 columns, with only one row being shown.&amp;nbsp; I wanted a human-readable display of all the fields in the table for any given row, i.e. i didn't want the user to have to scroll several screens across just to read the data for a single row.&amp;nbsp; Vertical scrolling is obviously easier, so i wrote a Repeater implementation, which works nicely.&amp;nbsp; For a table with X columns and Y rows, the output will have X rows and Y columns.&amp;nbsp; Screenshot below shows the output of all the ServerVariables in a HTTP-request, which is a good example of a datasource that does not naturally fit the traditional 'grid' display.&lt;br&gt;
&lt;pre&gt;&amp;lt;!-- ASPX usage --&amp;gt;&lt;br&gt;
&amp;lt;xyz:VerticalGrid ID="vGrid" runat="server" /&amp;gt;&lt;br&gt;
&lt;br&gt;
// sample databinding...&lt;br&gt;
this.vGrid1.DataSource = new DataView(dataSet1.Tables[0]);&lt;br&gt;
this.vGrid1.DataBind();&lt;br&gt;
&lt;br&gt;
/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// A Repeater control that shows the rows and columns inverted. 
&lt;br&gt;
/// No template is required for the items.&lt;br&gt;
/// The datasource must be an ADO.Net DataView&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
[ToolboxData("&amp;lt;{0}:VerticalGrid runat=server&amp;gt;&amp;lt;/{0}:VerticalGrid&amp;gt;")]&lt;br&gt;
public class VerticalGrid : Repeater&lt;br&gt;
{&lt;br&gt;
public VerticalGrid()&lt;br&gt;
{&lt;br&gt;
this.EnableViewState = false;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
protected override void Render(HtmlTextWriter writer)&lt;br&gt;
{&lt;br&gt;
// invert the rows and cols&lt;br&gt;
if (!(base.DataSource is DataView))&lt;br&gt;
throw new Exception("Error: only a dataview datasource can be used");&lt;br&gt;
&lt;br&gt;
DataView dv = base.DataSource as DataView;&lt;br&gt;
&lt;br&gt;
// output start of table&lt;br&gt;
writer.Write("\n&amp;lt;table class='grid'&amp;gt;");&lt;br&gt;
&lt;br&gt;
// output each row&lt;br&gt;
for (int i = 0; i &amp;lt; dv.Table.Columns.Count; i++)&lt;br&gt;
{&lt;br&gt;
writer.Write("\n&amp;lt;tr class='{0}'&amp;gt;&amp;lt;th&amp;gt;{1}&amp;lt;/th&amp;gt;", i % 2 == 1 ? "gI"
: "gA", dv.Table.Columns[i].ColumnName); // output the column name in the first cell.
class names gI and gA are abbreviations of gridItem gridAlternatingItem, to reduce
output markup.&lt;br&gt;
for (int j = 0; j &amp;lt; dv.Count; j++)&lt;br&gt;
writer.Write("&amp;lt;td&amp;gt;{0}&amp;lt;/td&amp;gt;", dv[j].Row.IsNull(i) ? "&amp;amp;nbsp;" : dv[j][i].ToString());&lt;br&gt;
writer.Write("&amp;lt;/tr&amp;gt;");&lt;br&gt;
}&lt;br&gt;
writer.Write("\n&amp;lt;/table&amp;gt;");&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://tim.mackey.ie/content/binary/vGrid.jpg" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=876f74bb-586f-402e-acd6-ba3c000e5ce9" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,876f74bb-586f-402e-acd6-ba3c000e5ce9.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=37b1b4cb-dc2a-43ce-8385-6879e32ca368</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,37b1b4cb-dc2a-43ce-8385-6879e32ca368.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,37b1b4cb-dc2a-43ce-8385-6879e32ca368.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=37b1b4cb-dc2a-43ce-8385-6879e32ca368</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I know we're not supposed to be going live with .Net 3.5 / Orcas Beta 1 yet, but hey.  
<br /></p>
        <p>
I ran into a Crystal Reports deployment problem with an asp.net web application developed
in Orcas beta 1, using the bundled version of crystal reports.  The problem is
that the crystal report dlls used in a Beta 1 project are 10.5.3700.0 but there don't
appear to be any merge modules available to support this version number, so there
is no supported way to run the Orcas version of Crystal Reports on a server, without
installing Orcas itself.  I tried numerous options of digging out the 10.5.3700.0
dlls from <font color="#0000ff" face="Courier New">program files\common files\business
objects</font> etc and putting them in the web site <i>bin</i> directory on the server,
but that didn't work.  The obvious error message that comes up is as follows:
</p>
        <p>
          <span>
          </span>
        </p>
        <pre>
          <font color="#ff0000">
            <i>
              <i>Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, 
<br />
Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. 
<br />
The system cannot find the file specified.</i>
            </i>
          </font>
        </pre>
        <p>
what i ended up doing was instructing the web application to bind to the 10.2.3600.0
versions of the assemblies, which are already deployed using the normal CR server
install. 
<br /></p>
        <p>
here is what i added to the end of my web.config file to get it going:<br /></p>
        <pre>
          <i>
            <i>    ....<br />
&lt;runtime&gt;<br />
        &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;<br />
            &lt;dependentAssembly&gt;<br />
                &lt;assemblyIdentity
name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304"/&gt;<br />
                &lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&gt;<br />
            &lt;/dependentAssembly&gt;<br />
            &lt;dependentAssembly&gt;<br />
                &lt;assemblyIdentity
name="CrystalDecisions.CrystalReports.Shared" publicKeyToken="692fbea5521e1304"/&gt;<br />
                &lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&gt;<br />
            &lt;/dependentAssembly&gt;<br />
            &lt;dependentAssembly&gt;<br />
                &lt;assemblyIdentity
name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304"/&gt;<br />
                &lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&gt;<br />
            &lt;/dependentAssembly&gt;<br />
        &lt;/assemblyBinding&gt;<br />
    &lt;/runtime&gt;<br />
&lt;/configuration&gt;<br /></i>
          </i>
        </pre>
        <img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=37b1b4cb-dc2a-43ce-8385-6879e32ca368" />
      </body>
      <title>Deploying Crystal Reports for Orcas Beta 1</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,37b1b4cb-dc2a-43ce-8385-6879e32ca368.aspx</guid>
      <link>http://tim.mackey.ie/DeployingCrystalReportsForOrcasBeta1.aspx</link>
      <pubDate>Thu, 17 May 2007 16:36:06 GMT</pubDate>
      <description>&lt;p&gt;
I know we're not supposed to be going live with .Net 3.5 / Orcas Beta 1 yet, but hey.&amp;nbsp; 
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
I ran into a Crystal Reports deployment problem with an asp.net web application developed
in Orcas beta 1, using the bundled version of crystal reports.&amp;nbsp; The problem is
that the crystal report dlls used in a Beta 1 project are 10.5.3700.0 but there don't
appear to be any merge modules available to support this version number, so there
is no supported way to run the Orcas version of Crystal Reports on a server, without
installing Orcas itself.&amp;nbsp; I tried numerous options of digging out the 10.5.3700.0
dlls from &lt;font color="#0000ff" face="Courier New"&gt;program files\common files\business
objects&lt;/font&gt; etc and putting them in the web site &lt;i&gt;bin&lt;/i&gt; directory on the server,
but that didn't work.&amp;nbsp; The obvious error message that comes up is as follows:
&lt;/p&gt;
&lt;p&gt;
&lt;span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;font color="#ff0000"&gt;&lt;i&gt;&lt;i&gt;Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, 
&lt;br&gt;
Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. 
&lt;br&gt;
The system cannot find the file specified.&lt;/i&gt;&lt;/i&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;
what i ended up doing was instructing the web application to bind to the 10.2.3600.0
versions of the assemblies, which are already deployed using the normal CR server
install. 
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
here is what i added to the end of my web.config file to get it going:&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;i&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;br&gt;
&amp;lt;runtime&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyIdentity
name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyIdentity
name="CrystalDecisions.CrystalReports.Shared" publicKeyToken="692fbea5521e1304"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;assemblyIdentity
name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;bindingRedirect
oldVersion="10.5.3700.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/assemblyBinding&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/runtime&amp;gt;&lt;br&gt;
&amp;lt;/configuration&amp;gt;&lt;br&gt;
&lt;/i&gt;&lt;/i&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=37b1b4cb-dc2a-43ce-8385-6879e32ca368" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,37b1b4cb-dc2a-43ce-8385-6879e32ca368.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=083acbb9-86f6-4ad6-a893-f3a7f31fe04e</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,083acbb9-86f6-4ad6-a893-f3a7f31fe04e.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,083acbb9-86f6-4ad6-a893-f3a7f31fe04e.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=083acbb9-86f6-4ad6-a893-f3a7f31fe04e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">i spent hours trying to troubleshoot this. 
obviously the error makes no sense because CR should not be logging on to anything
in a dataset scenario.<br />
anyway, a thousand thanks to Jason for his post on the <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=259341&amp;SiteID=1">MSDN
forums</a> with the simple answer: set the datasource to the DataTable, not the DataSet. 
<br /><br />
i can't wait to lose Crystal reports altogether and move to the microsoft reporting
thingy, i haven't had time to play about with it yet but at least it will be properly
programmed and it won't contain the 10 years of bugs that crystal reports have carried
through each release of their software.  &lt;/RANT&gt;<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=083acbb9-86f6-4ad6-a893-f3a7f31fe04e" /></body>
      <title>Crystal Reports: Incorrect Log on Parameters for Dataset source</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,083acbb9-86f6-4ad6-a893-f3a7f31fe04e.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsIncorrectLogOnParametersForDatasetSource.aspx</link>
      <pubDate>Wed, 02 May 2007 17:43:46 GMT</pubDate>
      <description>i spent hours trying to troubleshoot this.&amp;nbsp; obviously the error makes no sense because CR should not be logging on to anything in a dataset scenario.&lt;br&gt;
anyway, a thousand thanks to Jason for his post on the &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=259341&amp;amp;SiteID=1"&gt;MSDN
forums&lt;/a&gt; with the simple answer: set the datasource to the DataTable, not the DataSet. 
&lt;br&gt;
&lt;br&gt;
i can't wait to lose Crystal reports altogether and move to the microsoft reporting
thingy, i haven't had time to play about with it yet but at least it will be properly
programmed and it won't contain the 10 years of bugs that crystal reports have carried
through each release of their software.&amp;nbsp; &amp;lt;/RANT&amp;gt;&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=083acbb9-86f6-4ad6-a893-f3a7f31fe04e" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,083acbb9-86f6-4ad6-a893-f3a7f31fe04e.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=0ffd4a23-6e4d-4553-a535-edb86081eb2f</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,0ffd4a23-6e4d-4553-a535-edb86081eb2f.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,0ffd4a23-6e4d-4553-a535-edb86081eb2f.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=0ffd4a23-6e4d-4553-a535-edb86081eb2f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">here are a few of my main findings/hurdles
encountered when upgrading May CTP web projects to Orcas beta 1 Web Application Projects. 
I'm targeting version 3.5 of the framework for deployment on a Server 2003 with .Net
2.0 runtime installed, i will update this article if it doesn't work out.  
<br /><ul><li>
if you had any code in the "App_Code" folder, VS will probably have set the compile
action to "content", it should be changed to "compile".  otherwise you will get
errors like: <font color="#ff0000"><i>The type or namespace name 'xyz' could not be
found (are you missing a using directive or an assembly reference?)</i></font></li><li>
you'll have to remove any reference to the System.Query and System.Expressions, these
are not part of the new LINQ spec.</li><li>
Replace System.Data.DLinq with System.Data.Linq.</li><li>
if you want to use any LINQ expressions, like <i>"from x in db.Table select x" </i>then
you need to include the System.Linq namespace.  otherwise you will get errors
like '<font color="#ff0000"><i>System.Data.Linq.Table&lt;xyz&gt;' does not contain
a definition for 'Where' and no extension method 'Where' accepting a first argument
of type 'System.Data.Linq.Table&lt;xyz&gt;' could be found (are you missing a using
directive or an assembly reference?)<br /></i></font></li><li>
you will also need to include System.Linq.Expressions if you are using "language-level
code expressions to be represented as objects in the form of expression trees".</li></ul>
The old LINQ assemblies are versioned 1.0.2319.19044 (May CTP) but the new ones for
Beta 1 are versioned 2.0.0.0.  Have a check through the referenced assemblies
in your project to make sure you have the latest versions.  
<br /><br /><h3>Crystal reports
</h3>
look out for the new crystal report assemblies, 10.5.3700.0.  a web app referencing
the new versions in web.config will complain if these versions are not available on
the server.  i'll update soon when i have found out how to do this.<br /><br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0ffd4a23-6e4d-4553-a535-edb86081eb2f" /></body>
      <title>LINQ: upgrading May CTP projects to Orcas Beta 1</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,0ffd4a23-6e4d-4553-a535-edb86081eb2f.aspx</guid>
      <link>http://tim.mackey.ie/LINQUpgradingMayCTPProjectsToOrcasBeta1.aspx</link>
      <pubDate>Mon, 30 Apr 2007 10:50:28 GMT</pubDate>
      <description>here are a few of my main findings/hurdles encountered when upgrading May CTP web projects to Orcas beta 1 Web Application Projects.&amp;nbsp; I'm targeting version 3.5 of the framework for deployment on a Server 2003 with .Net 2.0 runtime installed, i will update this article if it doesn't work out.&amp;nbsp; &lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
if you had any code in the "App_Code" folder, VS will probably have set the compile
action to "content", it should be changed to "compile".&amp;nbsp; otherwise you will get
errors like: &lt;font color="#ff0000"&gt;&lt;i&gt;The type or namespace name 'xyz' could not be
found (are you missing a using directive or an assembly reference?)&lt;/i&gt;&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
you'll have to remove any reference to the System.Query and System.Expressions, these
are not part of the new LINQ spec.&lt;/li&gt;
&lt;li&gt;
Replace System.Data.DLinq with System.Data.Linq.&lt;/li&gt;
&lt;li&gt;
if you want to use any LINQ expressions, like &lt;i&gt;"from x in db.Table select x" &lt;/i&gt;then
you need to include the System.Linq namespace.&amp;nbsp; otherwise you will get errors
like '&lt;font color="#ff0000"&gt;&lt;i&gt;System.Data.Linq.Table&amp;lt;xyz&amp;gt;' does not contain
a definition for 'Where' and no extension method 'Where' accepting a first argument
of type 'System.Data.Linq.Table&amp;lt;xyz&amp;gt;' could be found (are you missing a using
directive or an assembly reference?)&lt;br&gt;
&lt;/i&gt;&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
you will also need to include System.Linq.Expressions if you are using "language-level
code expressions to be represented as objects in the form of expression trees".&lt;/li&gt;
&lt;/ul&gt;
The old LINQ assemblies are versioned 1.0.2319.19044 (May CTP) but the new ones for
Beta 1 are versioned 2.0.0.0.&amp;nbsp; Have a check through the referenced assemblies
in your project to make sure you have the latest versions.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
&lt;h3&gt;Crystal reports
&lt;/h3&gt;
look out for the new crystal report assemblies, 10.5.3700.0.&amp;nbsp; a web app referencing
the new versions in web.config will complain if these versions are not available on
the server.&amp;nbsp; i'll update soon when i have found out how to do this.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0ffd4a23-6e4d-4553-a535-edb86081eb2f" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,0ffd4a23-6e4d-4553-a535-edb86081eb2f.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=0f204bf6-1aa4-4d91-94a8-440b69e390aa</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,0f204bf6-1aa4-4d91-94a8-440b69e390aa.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,0f204bf6-1aa4-4d91-94a8-440b69e390aa.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=0f204bf6-1aa4-4d91-94a8-440b69e390aa</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">If you run a web server, chances are you
have some form of automated monitoring system in place.  If you use MOM or another
enterprise level thing then this post won't be of much relevance.  If, like me,
you have simpler requirements, read on.<br /><br />
I have been caught out a few times with my web sites being down because Windows Server
2003 automatically installed an update and something went wrong and IIS got stopped,
or like this morning at 4am, SQL 2005 SP2 failed to install and left the SQL Service
offline.  i didn't find out till i got a phone call from a client.<br /><br />
My datacenter provide very good ping monitoring with SMS alerts etc., but this is
not a complete solution because the web site may have a configuration error, and it
will still respond to pings.  similarly, you can't just check for an OK HTTP
status code because your error ASPX page may not be configured to send an error HTTP
status code.<br /><br />
I have used various online web site monitoring services, with varying degrees of success
/ satisfaction.  My current provider are InternetVista.com and for €70 a year
i get a 10 minute check for a single HTTP site, with a keyword match on the contents
of the page, and an email/sms alert if the match is not found.  You can pay for
extra and more frequent checks, but €70 is as much as i think the service is worth. 
To have this level of checking done on 10 sites would cost a lot, so to save a few
quid i wrote a very simple aspx page that does a series of tests on all the resources
i want to verify on the server, e.g. SQL Server, MS Access, IIS web sites.  The
aspx code is listed below, i wrote it inline rather than compiled/dll because it is
easier to deploy in an existing web site without any risk of any side effects (dll
collisions), it should be straight forward to understand for a c# programmer. 
let me know if you have questions.  It runs in a few miliseconds on my server
so i'm not worried about polling all these resources every 10 mins.<br /><br /><br /><br />
Run_Server_Tests.aspx code:<br /><pre>&lt;%@ Page Language="C#" %&gt;<br />
&lt;%@ Import Namespace="System.Collections" %&gt;<br />
&lt;%@ Import Namespace="System.Collections.Generic" %&gt;<br />
&lt;%@ Import Namespace="System.Data" %&gt;<br />
&lt;%@ Import Namespace="System.Data.OleDb" %&gt;<br />
&lt;%@ Import Namespace="System.Data.SqlClient" %&gt;<br />
&lt;%@ Import Namespace="System.Net" %&gt;<br /><br />
&lt;script RunAt="server"&gt;<br /><br />
/* Server Monitoring Script:<br />
* - test SQL databases by running an sql string against an SQL connection string<br />
* - test Access databases by running an sql string against a JET connection string<br />
* - test web sites by Regex matching a search string against the contents of a HttpWebRequest<br />
*/<br /><br />
enum TestType {Sql_Server, Ms_Access, Http_Request } // different types of supported
requests<br /><br />
/// &lt;summary&gt;<br />
/// Container class to represent a 'test' object for a resource on the server.<br />
/// &lt;/summary&gt;<br />
class TestObject<br />
{<br />
public TestType Type; // e.g. Sql_Server.<br />
public string TestString; // e.g. connection string for a database. or URI for http
request.<br />
public string TestParam; // e.g. sql string for a database. or search string for a
http request.<br /><br />
public TestObject(TestType type, string testString, string testParam)<br />
{<br />
this.Type = type; 
<br />
this.TestString = testString;<br />
this.TestParam = testParam;<br />
}<br />
}<br /><br />
void Page_Load(object sender, EventArgs e)<br />
{<br />
List&lt;TestObject&gt; tests = new List&lt;TestObject&gt;();<br /><br />
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB1;Integrated
Security=True", "select top 10 * from Table1"));<br />
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB2;Integrated
Security=True", "select top 10 * from Table1"));<br />
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB3;Integrated
Security=True", "select top 10 * from Table1"));<br />
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB4;Integrated
Security=True", "select top 10 * from Table1"));<br /><br />
tests.Add(new TestObject(TestType.Ms_Access, @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Inetpub\Database\DB5.mdb;Persist Security Info=True", "select top 10 * from
Table1"));<br />
tests.Add(new TestObject(TestType.Ms_Access, @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Inetpub\Database\DB6.mdb;Persist Security Info=True", "select top 10 * from
Table1"));<br /><br />
tests.Add(new TestObject(TestType.Http_Request, "http://mysite1.ie/", "Site 1"));<br />
tests.Add(new TestObject(TestType.Http_Request, "http://mysite2.ie/", "Site 2"));<br />
tests.Add(new TestObject(TestType.Http_Request, "https://mysite3.ie/", "Site 3"));<br />
tests.Add(new TestObject(TestType.Http_Request, "https://mysite4.ie/", "Site 4"));<br />
tests.Add(new TestObject(TestType.Http_Request, "https://mysite5.ie/", "Site 5"));<br /><br />
int numCompleted = 0;<br />
int numFailed = 0;<br /><br />
// write the HTML header. (a result is flushed to the client after each test finishes.)<br />
Flush(@" 
<br />
&lt;!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Server Test&lt;/title&gt;<br />
&lt;meta name='ROBOTS' content='NOINDEX,NOFOLLOW'&gt;<br />
&lt;link rel='stylesheet' type='text/css' href='ServerTestStyles.css' /&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;");<br /><br />
foreach(TestObject test in tests)<br />
{ 
<br />
try<br />
{<br />
switch(test.Type)<br />
{ 
<br />
case TestType.Sql_Server:<br />
runQuerySql(test.TestParam, test.TestString);<br />
break;<br />
case TestType.Ms_Access:<br />
runQueryOleDb(test.TestParam, test.TestString);<br />
break;<br />
case TestType.Http_Request:<br />
string pageContents = new WebClient().DownloadString(test.TestString);<br />
if(!Regex.IsMatch(pageContents, test.TestParam, RegexOptions.IgnoreCase))<br />
throw new Exception("Search string not found: " + test.TestParam);<br />
break;<br />
default:<br />
throw new Exception("Test type not handled " + test.Type);<br />
}<br />
Flush(String.Format("&lt;span class='pass'&gt;Pass&lt;/span&gt; &amp;nbsp; &lt;span
class='type'&gt;{0}&lt;/span&gt; &amp;nbsp; {1} &lt;hr /&gt;", test.Type, test.TestString));<br />
numCompleted++;<br />
}<br />
catch(Exception ex)<br />
{<br />
Flush(String.Format("&lt;span class='fail'&gt;Fail&lt;/span&gt; &amp;nbsp; {1} &lt;span
class='type'&gt;{0}&lt;/span&gt;&lt;BR&gt;&lt;span class='error'&gt;{2}&lt;/span&gt;&lt;hr
/&gt;", test.Type, test.TestString, ex.Message));<br />
numFailed++;<br />
}<br />
}<br />
if(numFailed &gt; 0)<br />
Flush(String.Format("&lt;h1&gt;{0} errors occured&lt;/h1&gt;", numFailed));<br />
else<br />
Flush(String.Format("&lt;h1&gt;All Good!&lt;/h1&gt;", numFailed)); // if you use this
page with an automated monitoring service, look for "All Good" in the page contents.
otherwise an error occured<br />
Flush("&lt;/body&gt;&lt;/html&gt;");<br />
}<br /><br />
/// &lt;summary&gt;<br />
/// Method to run an sql string against an sql database<br />
/// &lt;/summary&gt;<br />
public static DataSet runQuerySql(string sql, string connString)<br />
{<br />
SqlConnection conn = new SqlConnection(connString);<br />
DataSet ds = new DataSet();<br />
SqlDataAdapter dba = new SqlDataAdapter();<br />
SqlCommand cmd = new SqlCommand(sql, conn);<br /><br />
try<br />
{<br />
dba.SelectCommand = cmd;<br />
dba.Fill(ds, "Table");<br />
return (ds);<br />
}<br />
catch(Exception e)<br />
{<br />
throw e;<br />
}<br />
finally<br />
{<br />
cmd.Connection.Close();<br />
conn.Close();<br />
}<br />
}<br /><br />
/// &lt;summary&gt;<br />
/// Method to run an sql string against an Access database<br />
/// &lt;/summary&gt;<br />
public static DataSet runQueryOleDb(string sql, string connString)<br />
{<br />
OleDbConnection conn = new OleDbConnection(connString);<br />
DataSet ds = new DataSet();<br />
OleDbDataAdapter dba = new OleDbDataAdapter();<br />
OleDbCommand cmd = new OleDbCommand(sql, conn);<br /><br />
try<br />
{<br />
dba.SelectCommand = cmd;<br />
dba.Fill(ds, "Table");<br />
return (ds);<br />
}<br />
catch(Exception e)<br />
{<br />
throw e;<br />
}<br />
finally<br />
{<br />
cmd.Connection.Close();<br />
conn.Close();<br />
}<br />
}<br /><br />
/// &lt;summary&gt;<br />
/// Flush output to the browser (useful to indicate which tests are causing any delay)<br />
/// &lt;/summary&gt;<br />
/// &lt;param name="output"&gt;&lt;/param&gt;<br />
private void Flush(string output)<br />
{<br />
Response.Write(output);<br />
Response.Flush();<br />
}<br /><br />
&lt;/script&gt;<br /></pre><p>
ServerTestStyles.css:  (just to make the output more legible)
</p><pre>body<br />
{<br />
font-size: 90%;<br />
font-family: Calibri, Helvetica, Sans-Serif;<br />
padding: .5em;<br />
}<br /><br />
hr<br />
{<br />
color: #87ceeb;<br />
background-color: #87ceeb;<br />
margin: .3em 0 .3em 0;<br />
padding: 0;<br />
height: 1px;<br />
}<br /><br />
.pass<br />
{<br />
color: Blue;<br />
font-weight: bold;<br />
}<br />
.fail<br />
{<br />
color: Red;<br />
font-weight: bold;<br />
}<br />
.type<br />
{<br />
color: purple;<br />
font-weight: bold;<br />
}<br />
.error<br />
{<br />
color: Red;<br />
font-size: small;<br />
}<br /></pre><p>
I have configured the test in InternetVista to search for "All Good" in the url for
the test page.  If this isn't present, i'll get an SMS/email alert and i can
go and see what exactly is wrong.  It should be fairly easy to add other test
types if you have different resources you need to check on.<br />
Enjoy.<br /></p><img src="http://tim.mackey.ie/content/binary/server_test.jpg" border="0" /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0f204bf6-1aa4-4d91-94a8-440b69e390aa" /></body>
      <title>Really simple and affordable web server monitoring </title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,0f204bf6-1aa4-4d91-94a8-440b69e390aa.aspx</guid>
      <link>http://tim.mackey.ie/ReallySimpleAndAffordableWebServerMonitoring.aspx</link>
      <pubDate>Fri, 09 Mar 2007 17:43:24 GMT</pubDate>
      <description>If you run a web server, chances are you have some form of automated monitoring system in place.&amp;nbsp; If you use MOM or another enterprise level thing then this post won't be of much relevance.&amp;nbsp; If, like me, you have simpler requirements, read on.&lt;br&gt;
&lt;br&gt;
I have been caught out a few times with my web sites being down because Windows Server
2003 automatically installed an update and something went wrong and IIS got stopped,
or like this morning at 4am, SQL 2005 SP2 failed to install and left the SQL Service
offline.&amp;nbsp; i didn't find out till i got a phone call from a client.&lt;br&gt;
&lt;br&gt;
My datacenter provide very good ping monitoring with SMS alerts etc., but this is
not a complete solution because the web site may have a configuration error, and it
will still respond to pings.&amp;nbsp; similarly, you can't just check for an OK HTTP
status code because your error ASPX page may not be configured to send an error HTTP
status code.&lt;br&gt;
&lt;br&gt;
I have used various online web site monitoring services, with varying degrees of success
/ satisfaction.&amp;nbsp; My current provider are InternetVista.com and for €70 a year
i get a 10 minute check for a single HTTP site, with a keyword match on the contents
of the page, and an email/sms alert if the match is not found.&amp;nbsp; You can pay for
extra and more frequent checks, but €70 is as much as i think the service is worth.&amp;nbsp;
To have this level of checking done on 10 sites would cost a lot, so to save a few
quid i wrote a very simple aspx page that does a series of tests on all the resources
i want to verify on the server, e.g. SQL Server, MS Access, IIS web sites.&amp;nbsp; The
aspx code is listed below, i wrote it inline rather than compiled/dll because it is
easier to deploy in an existing web site without any risk of any side effects (dll
collisions), it should be straight forward to understand for a c# programmer.&amp;nbsp;
let me know if you have questions.&amp;nbsp; It runs in a few miliseconds on my server
so i'm not worried about polling all these resources every 10 mins.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Run_Server_Tests.aspx code:&lt;br&gt;
&lt;pre&gt;&amp;lt;%@ Page Language="C#" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Collections" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Collections.Generic" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Data" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Data.OleDb" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Data.SqlClient" %&amp;gt;&lt;br&gt;
&amp;lt;%@ Import Namespace="System.Net" %&amp;gt;&lt;br&gt;
&lt;br&gt;
&amp;lt;script RunAt="server"&amp;gt;&lt;br&gt;
&lt;br&gt;
/* Server Monitoring Script:&lt;br&gt;
* - test SQL databases by running an sql string against an SQL connection string&lt;br&gt;
* - test Access databases by running an sql string against a JET connection string&lt;br&gt;
* - test web sites by Regex matching a search string against the contents of a HttpWebRequest&lt;br&gt;
*/&lt;br&gt;
&lt;br&gt;
enum TestType {Sql_Server, Ms_Access, Http_Request } // different types of supported
requests&lt;br&gt;
&lt;br&gt;
/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// Container class to represent a 'test' object for a resource on the server.&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
class TestObject&lt;br&gt;
{&lt;br&gt;
public TestType Type; // e.g. Sql_Server.&lt;br&gt;
public string TestString; // e.g. connection string for a database. or URI for http
request.&lt;br&gt;
public string TestParam; // e.g. sql string for a database. or search string for a
http request.&lt;br&gt;
&lt;br&gt;
public TestObject(TestType type, string testString, string testParam)&lt;br&gt;
{&lt;br&gt;
this.Type = type; 
&lt;br&gt;
this.TestString = testString;&lt;br&gt;
this.TestParam = testParam;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
void Page_Load(object sender, EventArgs e)&lt;br&gt;
{&lt;br&gt;
List&amp;lt;TestObject&amp;gt; tests = new List&amp;lt;TestObject&amp;gt;();&lt;br&gt;
&lt;br&gt;
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB1;Integrated
Security=True", "select top 10 * from Table1"));&lt;br&gt;
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB2;Integrated
Security=True", "select top 10 * from Table1"));&lt;br&gt;
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB3;Integrated
Security=True", "select top 10 * from Table1"));&lt;br&gt;
tests.Add(new TestObject(TestType.Sql_Server, @"Data Source=.\SQLEXPRESS;Initial Catalog=DB4;Integrated
Security=True", "select top 10 * from Table1"));&lt;br&gt;
&lt;br&gt;
tests.Add(new TestObject(TestType.Ms_Access, @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Inetpub\Database\DB5.mdb;Persist Security Info=True", "select top 10 * from
Table1"));&lt;br&gt;
tests.Add(new TestObject(TestType.Ms_Access, @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\Inetpub\Database\DB6.mdb;Persist Security Info=True", "select top 10 * from
Table1"));&lt;br&gt;
&lt;br&gt;
tests.Add(new TestObject(TestType.Http_Request, "http://mysite1.ie/", "Site 1"));&lt;br&gt;
tests.Add(new TestObject(TestType.Http_Request, "http://mysite2.ie/", "Site 2"));&lt;br&gt;
tests.Add(new TestObject(TestType.Http_Request, "https://mysite3.ie/", "Site 3"));&lt;br&gt;
tests.Add(new TestObject(TestType.Http_Request, "https://mysite4.ie/", "Site 4"));&lt;br&gt;
tests.Add(new TestObject(TestType.Http_Request, "https://mysite5.ie/", "Site 5"));&lt;br&gt;
&lt;br&gt;
int numCompleted = 0;&lt;br&gt;
int numFailed = 0;&lt;br&gt;
&lt;br&gt;
// write the HTML header. (a result is flushed to the client after each test finishes.)&lt;br&gt;
Flush(@" 
&lt;br&gt;
&amp;lt;!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'&amp;gt;&lt;br&gt;
&amp;lt;html&amp;gt;&lt;br&gt;
&amp;lt;head&amp;gt;&lt;br&gt;
&amp;lt;title&amp;gt;Server Test&amp;lt;/title&amp;gt;&lt;br&gt;
&amp;lt;meta name='ROBOTS' content='NOINDEX,NOFOLLOW'&amp;gt;&lt;br&gt;
&amp;lt;link rel='stylesheet' type='text/css' href='ServerTestStyles.css' /&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;");&lt;br&gt;
&lt;br&gt;
foreach(TestObject test in tests)&lt;br&gt;
{ 
&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
switch(test.Type)&lt;br&gt;
{ 
&lt;br&gt;
case TestType.Sql_Server:&lt;br&gt;
runQuerySql(test.TestParam, test.TestString);&lt;br&gt;
break;&lt;br&gt;
case TestType.Ms_Access:&lt;br&gt;
runQueryOleDb(test.TestParam, test.TestString);&lt;br&gt;
break;&lt;br&gt;
case TestType.Http_Request:&lt;br&gt;
string pageContents = new WebClient().DownloadString(test.TestString);&lt;br&gt;
if(!Regex.IsMatch(pageContents, test.TestParam, RegexOptions.IgnoreCase))&lt;br&gt;
throw new Exception("Search string not found: " + test.TestParam);&lt;br&gt;
break;&lt;br&gt;
default:&lt;br&gt;
throw new Exception("Test type not handled " + test.Type);&lt;br&gt;
}&lt;br&gt;
Flush(String.Format("&amp;lt;span class='pass'&amp;gt;Pass&amp;lt;/span&amp;gt; &amp;amp;nbsp; &amp;lt;span
class='type'&amp;gt;{0}&amp;lt;/span&amp;gt; &amp;amp;nbsp; {1} &amp;lt;hr /&amp;gt;", test.Type, test.TestString));&lt;br&gt;
numCompleted++;&lt;br&gt;
}&lt;br&gt;
catch(Exception ex)&lt;br&gt;
{&lt;br&gt;
Flush(String.Format("&amp;lt;span class='fail'&amp;gt;Fail&amp;lt;/span&amp;gt; &amp;amp;nbsp; {1} &amp;lt;span
class='type'&amp;gt;{0}&amp;lt;/span&amp;gt;&amp;lt;BR&amp;gt;&amp;lt;span class='error'&amp;gt;{2}&amp;lt;/span&amp;gt;&amp;lt;hr
/&amp;gt;", test.Type, test.TestString, ex.Message));&lt;br&gt;
numFailed++;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
if(numFailed &amp;gt; 0)&lt;br&gt;
Flush(String.Format("&amp;lt;h1&amp;gt;{0} errors occured&amp;lt;/h1&amp;gt;", numFailed));&lt;br&gt;
else&lt;br&gt;
Flush(String.Format("&amp;lt;h1&amp;gt;All Good!&amp;lt;/h1&amp;gt;", numFailed)); // if you use this
page with an automated monitoring service, look for "All Good" in the page contents.
otherwise an error occured&lt;br&gt;
Flush("&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;");&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// Method to run an sql string against an sql database&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
public static DataSet runQuerySql(string sql, string connString)&lt;br&gt;
{&lt;br&gt;
SqlConnection conn = new SqlConnection(connString);&lt;br&gt;
DataSet ds = new DataSet();&lt;br&gt;
SqlDataAdapter dba = new SqlDataAdapter();&lt;br&gt;
SqlCommand cmd = new SqlCommand(sql, conn);&lt;br&gt;
&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
dba.SelectCommand = cmd;&lt;br&gt;
dba.Fill(ds, "Table");&lt;br&gt;
return (ds);&lt;br&gt;
}&lt;br&gt;
catch(Exception e)&lt;br&gt;
{&lt;br&gt;
throw e;&lt;br&gt;
}&lt;br&gt;
finally&lt;br&gt;
{&lt;br&gt;
cmd.Connection.Close();&lt;br&gt;
conn.Close();&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// Method to run an sql string against an Access database&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
public static DataSet runQueryOleDb(string sql, string connString)&lt;br&gt;
{&lt;br&gt;
OleDbConnection conn = new OleDbConnection(connString);&lt;br&gt;
DataSet ds = new DataSet();&lt;br&gt;
OleDbDataAdapter dba = new OleDbDataAdapter();&lt;br&gt;
OleDbCommand cmd = new OleDbCommand(sql, conn);&lt;br&gt;
&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
dba.SelectCommand = cmd;&lt;br&gt;
dba.Fill(ds, "Table");&lt;br&gt;
return (ds);&lt;br&gt;
}&lt;br&gt;
catch(Exception e)&lt;br&gt;
{&lt;br&gt;
throw e;&lt;br&gt;
}&lt;br&gt;
finally&lt;br&gt;
{&lt;br&gt;
cmd.Connection.Close();&lt;br&gt;
conn.Close();&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// Flush output to the browser (useful to indicate which tests are causing any delay)&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
/// &amp;lt;param name="output"&amp;gt;&amp;lt;/param&amp;gt;&lt;br&gt;
private void Flush(string output)&lt;br&gt;
{&lt;br&gt;
Response.Write(output);&lt;br&gt;
Response.Flush();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
ServerTestStyles.css:&amp;nbsp; (just to make the output more legible)
&lt;/p&gt;
&lt;pre&gt;body&lt;br&gt;
{&lt;br&gt;
font-size: 90%;&lt;br&gt;
font-family: Calibri, Helvetica, Sans-Serif;&lt;br&gt;
padding: .5em;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
hr&lt;br&gt;
{&lt;br&gt;
color: #87ceeb;&lt;br&gt;
background-color: #87ceeb;&lt;br&gt;
margin: .3em 0 .3em 0;&lt;br&gt;
padding: 0;&lt;br&gt;
height: 1px;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
.pass&lt;br&gt;
{&lt;br&gt;
color: Blue;&lt;br&gt;
font-weight: bold;&lt;br&gt;
}&lt;br&gt;
.fail&lt;br&gt;
{&lt;br&gt;
color: Red;&lt;br&gt;
font-weight: bold;&lt;br&gt;
}&lt;br&gt;
.type&lt;br&gt;
{&lt;br&gt;
color: purple;&lt;br&gt;
font-weight: bold;&lt;br&gt;
}&lt;br&gt;
.error&lt;br&gt;
{&lt;br&gt;
color: Red;&lt;br&gt;
font-size: small;&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
I have configured the test in InternetVista to search for "All Good" in the url for
the test page.&amp;nbsp; If this isn't present, i'll get an SMS/email alert and i can
go and see what exactly is wrong.&amp;nbsp; It should be fairly easy to add other test
types if you have different resources you need to check on.&lt;br&gt;
Enjoy.&lt;br&gt;
&lt;/p&gt;
&lt;img src="http://tim.mackey.ie/content/binary/server_test.jpg" border="0"&gt;&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=0f204bf6-1aa4-4d91-94a8-440b69e390aa" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,0f204bf6-1aa4-4d91-94a8-440b69e390aa.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Database</category>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=47c6d892-b64b-4349-9cf0-de0697e2b7f2</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,47c6d892-b64b-4349-9cf0-de0697e2b7f2.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,47c6d892-b64b-4349-9cf0-de0697e2b7f2.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=47c6d892-b64b-4349-9cf0-de0697e2b7f2</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Here is the event log crash entry:<br /><p><font color="#ff0000">Faulting application devenv.exe, version 8.0.50727.762, time
stamp 0x45716759, faulting module craxddrt.dll_unloaded, version 0.0.0.0,<br />
time stamp 0x43068582, exception code 0xc0000005, fault offset 0x0d26e30f, process
id 0x1180, application start time 0x01c75cae13960a41.</font></p>
it would crash completely randomly, even if i had closed all crystal reports and was
working in a style sheet or other such harmless file. As i later found out, it was
because the solution opened by default with the last crystal report i was working
on, and this seemed to start some crystal report ActiveX thing that craps out on Vista. 
sometimes it would take 2 minutes and sometimes 5 minutes, but it would always crash,
even if i closed the report straight away.  The only way to get rid of it was
to load up VS, close the report immediately and safely close VS before it got a chance
to crash!  then next time it opens, there is no crystal report and the ActiveX
control never loads.  it works ok now, although this is just one of a long list
of complaints i have with VS 2005.  i think i'm allergic to crystal reports.<br /><br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=47c6d892-b64b-4349-9cf0-de0697e2b7f2" /></body>
      <title>FIX: VS 2005 crashes randomly when using Crystal Reports</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,47c6d892-b64b-4349-9cf0-de0697e2b7f2.aspx</guid>
      <link>http://tim.mackey.ie/FIXVS2005CrashesRandomlyWhenUsingCrystalReports.aspx</link>
      <pubDate>Fri, 02 Mar 2007 09:58:51 GMT</pubDate>
      <description>Here is the event log crash entry:&lt;br&gt;
&lt;p&gt;
&lt;font color="#ff0000"&gt;Faulting application devenv.exe, version 8.0.50727.762, time
stamp 0x45716759, faulting module craxddrt.dll_unloaded, version 0.0.0.0,&lt;br&gt;
time stamp 0x43068582, exception code 0xc0000005, fault offset 0x0d26e30f, process
id 0x1180, application start time 0x01c75cae13960a41.&lt;/font&gt;
&lt;/p&gt;
it would crash completely randomly, even if i had closed all crystal reports and was
working in a style sheet or other such harmless file. As i later found out, it was
because the solution opened by default with the last crystal report i was working
on, and this seemed to start some crystal report ActiveX thing that craps out on Vista.&amp;nbsp;
sometimes it would take 2 minutes and sometimes 5 minutes, but it would always crash,
even if i closed the report straight away.&amp;nbsp; The only way to get rid of it was
to load up VS, close the report immediately and safely close VS before it got a chance
to crash!&amp;nbsp; then next time it opens, there is no crystal report and the ActiveX
control never loads.&amp;nbsp; it works ok now, although this is just one of a long list
of complaints i have with VS 2005.&amp;nbsp; i think i'm allergic to crystal reports.&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=47c6d892-b64b-4349-9cf0-de0697e2b7f2" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,47c6d892-b64b-4349-9cf0-de0697e2b7f2.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=be13ff65-9d01-4ae3-b974-961cdd7ce180</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,be13ff65-9d01-4ae3-b974-961cdd7ce180.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,be13ff65-9d01-4ae3-b974-961cdd7ce180.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=be13ff65-9d01-4ae3-b974-961cdd7ce180</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">The full error i got was below:<br /><pre>Error    35    The type 'CrystalDecisions.Shared.ExportFormatType' exists in both 
<br />
'c:\Windows\assembly\GAC\CrystalDecisions.Shared\9.1.5000.0__692fbea5521e1304\CrystalDecisions.Shared.dll'
and 
<br />
'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Shared\10.2.3600.0__692fbea5521e1304\CrystalDecisions.Shared.dll'   
<br /></pre>The reason is because version 9 and 10 of crystal reports are installed on my
dev box and VS needed help deciding which one to use.  the fix was to specify
the exact assembly binding to use in web.config, as follows:<br /><pre>	&lt;runtime&gt;<br />
&lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;<br />
&lt;dependentAssembly&gt;<br />
&lt;assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304"
/&gt;<br />
&lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&gt;<br />
&lt;/dependentAssembly&gt;<br />
&lt;dependentAssembly&gt;<br />
&lt;assemblyIdentity name="CrystalDecisions.CrystalReports.Shared" publicKeyToken="692fbea5521e1304"
/&gt;<br />
&lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&gt;<br />
&lt;/dependentAssembly&gt;<br />
&lt;dependentAssembly&gt;<br />
&lt;assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304"
/&gt;<br />
&lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&gt;<br />
&lt;/dependentAssembly&gt;<br />
&lt;/assemblyBinding&gt;<br />
&lt;/runtime&gt;<br /></pre>thanks to <a href="http://blogs.gotdotnet.com/richarde/archive/2005/09/02/468187.aspx">rick
ersek</a> for the solution.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=be13ff65-9d01-4ae3-b974-961cdd7ce180" /></body>
      <title>Fix: VS 2005 compile error: The type 'xyz' exists in both X and Y</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,be13ff65-9d01-4ae3-b974-961cdd7ce180.aspx</guid>
      <link>http://tim.mackey.ie/FixVS2005CompileErrorTheTypeXyzExistsInBothXAndY.aspx</link>
      <pubDate>Fri, 23 Feb 2007 17:51:46 GMT</pubDate>
      <description>The full error i got was below:&lt;br&gt;
&lt;pre&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;35&amp;nbsp;&amp;nbsp; &amp;nbsp;The type 'CrystalDecisions.Shared.ExportFormatType' exists in both 
&lt;br&gt;
'c:\Windows\assembly\GAC\CrystalDecisions.Shared\9.1.5000.0__692fbea5521e1304\CrystalDecisions.Shared.dll'
and 
&lt;br&gt;
'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Shared\10.2.3600.0__692fbea5521e1304\CrystalDecisions.Shared.dll'&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&lt;/pre&gt;The reason is because version 9 and 10 of crystal reports are installed on my
dev box and VS needed help deciding which one to use.&amp;nbsp; the fix was to specify
the exact assembly binding to use in web.config, as follows:&lt;br&gt;
&lt;pre&gt;	&amp;lt;runtime&amp;gt;&lt;br&gt;
&amp;lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&amp;gt;&lt;br&gt;
&amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304"
/&amp;gt;&lt;br&gt;
&amp;lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;assemblyIdentity name="CrystalDecisions.CrystalReports.Shared" publicKeyToken="692fbea5521e1304"
/&amp;gt;&lt;br&gt;
&amp;lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304"
/&amp;gt;&lt;br&gt;
&amp;lt;bindingRedirect oldVersion="9.1.5000.0" newVersion="10.2.3600.0"/&amp;gt;&lt;br&gt;
&amp;lt;/dependentAssembly&amp;gt;&lt;br&gt;
&amp;lt;/assemblyBinding&amp;gt;&lt;br&gt;
&amp;lt;/runtime&amp;gt;&lt;br&gt;
&lt;/pre&gt;thanks to &lt;a href="http://blogs.gotdotnet.com/richarde/archive/2005/09/02/468187.aspx"&gt;rick
ersek&lt;/a&gt; for the solution.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=be13ff65-9d01-4ae3-b974-961cdd7ce180" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,be13ff65-9d01-4ae3-b974-961cdd7ce180.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=b5ede20f-bcb8-4b07-be43-7719eb2466da</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,b5ede20f-bcb8-4b07-be43-7719eb2466da.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,b5ede20f-bcb8-4b07-be43-7719eb2466da.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=b5ede20f-bcb8-4b07-be43-7719eb2466da</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div>using Forms auth in an asp.net web site, with a standard Login control, i found
a problem today where user 'Joe Bloggs' can log in with 'JOE BLOGGS' as his username. 
this messes up my database a little because User.Identity.Name yields 'JOE BLOGGS'
and i use this value in the application database. for consistency purposes i only
want to use the case-correct version of the username, as it was created. 
<br /><br />
to fix this, i added the following code to my login<br /><pre>    protected void Login1_LoggedIn(object sender, EventArgs e)<br />
    {<br />
        // correct the case of the username<br />
        foreach(MembershipUser u in Membership.GetAllUsers())<br />
            if(u.UserName.ToLower() ==
this.Login1.UserName.ToLower())<br />
            {<br />
                // fix
the username case<br />
                FormsAuthentication.SetAuthCookie(u.UserName,
true);<br />
            }<br />
    }</pre></div>
        <p>
        </p>
        <img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b5ede20f-bcb8-4b07-be43-7719eb2466da" />
      </body>
      <title>HowTo: Correct Login Username Case</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,b5ede20f-bcb8-4b07-be43-7719eb2466da.aspx</guid>
      <link>http://tim.mackey.ie/HowToCorrectLoginUsernameCase.aspx</link>
      <pubDate>Tue, 23 Jan 2007 15:05:27 GMT</pubDate>
      <description>&lt;div&gt;using Forms auth in an asp.net web site, with a standard Login control, i found
a problem today where user 'Joe Bloggs' can log in with 'JOE BLOGGS' as his username.&amp;nbsp;
this messes up my database a little because User.Identity.Name yields 'JOE BLOGGS'
and i use this value in the application database. for consistency purposes i only
want to use the case-correct version of the username, as it was created. 
&lt;br&gt;
&lt;br&gt;
to fix this, i added the following code to my login&lt;br&gt;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void Login1_LoggedIn(object sender, EventArgs e)&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// correct the case of the username&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;foreach(MembershipUser u in Membership.GetAllUsers())&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(u.UserName.ToLower() ==
this.Login1.UserName.ToLower())&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// fix
the username case&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;FormsAuthentication.SetAuthCookie(u.UserName,
true);&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b5ede20f-bcb8-4b07-be43-7719eb2466da" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,b5ede20f-bcb8-4b07-be43-7719eb2466da.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=5773cf51-d088-4afd-b841-f24a0b5d7be7</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,5773cf51-d088-4afd-b841-f24a0b5d7be7.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,5773cf51-d088-4afd-b841-f24a0b5d7be7.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=5773cf51-d088-4afd-b841-f24a0b5d7be7</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I was interested to see that <a href="http://ajax.asp.net/">Atlas/AJAX</a> has
now made it to Beta 2.  I looked at it earlier in the year but didn't have time
to really get stuck in.  So today i eventually got it working in conjunction
with <a href="http://msdn.microsoft.com/data/ref/linq/">LINQ</a>.  I wanted to
get a basic AutoComplete thing working off my database, with which i am hopefully
going to use LINQ throughout.<br /><br />
First of all, go to <a href="http://ajax.asp.net/">http://ajax.asp.net/</a> and download
and install the 3 bits they recommend.  
<br /><h2>Getting the darn thing to work
</h2><a href="http://blogs.msdn.com/brada/default.aspx">Brad Adams</a> has a very good
getting-started example <a href="http://blogs.msdn.com/brada/archive/2006/10/27/search-autocomplete-with-asp-net-ajax-extensions.aspx">on
this post</a>, i used his article as a starting point, but i had to sort out a few
other things first.  i couldn't get any documentation on the AutoCompleteExtender
so i scavenged some crucial facts off the net after a lot of fumbling around, i've
listed these below.  One mistake i made was to start testing the AutoComplete
control before making sure that the web service was returning correct data, my LINQ
query was chucking exceptions and the AJAX control doesn't give you any feedback on
exceptions, which is understandable and probably desirable.<a href="http://blogs.msdn.com/brada/default.aspx"><br /></a><ul><li>
you must mark your web service class with the <font color="#008000" face="Courier New">[ScriptService] </font>attribute,
you'll need the <font color="#008000" face="Courier New">Microsoft.Web.Script.Services</font> namespace
for this.<br /><pre>[WebService(Namespace = "http://whatever")]<br /><b>[ScriptService]</b><br />
public class AjaxService : System.Web.Services.WebService<br />
{ 
<br /></pre></li><li>
you need two parameters in your web service method, the naming of the parameters is
crucial: 
<br /><pre>[WebMethod]<br />
public string[] GetList(string <b>prefixText</b>, int count)</pre></li><li>
if you're using Linq, and if you're new at it like me, you might have trouble getting
your LINQ query results into a string array for the web service.  I tried returning
IEnumerable&lt;TableName&gt; and List&lt;string&gt; etc. but it didn't like that,
i ended up using the ToArray() extended method that is part of System.Query. 
Here is the query i used which concatenates some columns from the table into a collection
of strings.  
<br /><pre>IEnumerable&lt;string&gt; ds =<br />
            from r in MyDataBase.Restaurants<br />
            where r.RestaurantName.Contains(prefixText)<br />
            select (r.RestaurantName
+ "," + r.Address1 + "," + r.County); // join the name + address in a string<br />
string[] results = ds.ToArray&lt;string&gt;();<br />
return results;</pre></li></ul><h2>Formatting the AutoCompleteExtender
</h2>
The control has some nasty hard-coded values, but where there's a will there's a way. 
Thanks to the Firefox dom inspector and the CSS !important modifier, all is not lost.  
<br /><br />
The control does have a property called CompletionListElementID which specifies the
container element where the results are inserted.  I put a simple DIV next to
the textbox:<br /><pre>&lt;div id="AutoComplete" runat="server"&gt; &lt;/div&gt;</pre>Then in my stylesheet
i have the following values to override the hard-coded styles set by the control:<br /><pre>#AutoComplete<br />
{<br />
    width: auto !important;    
<br />
    overflow: visible !important;<br />
}<br />
#AutoComplete div<br />
{<br />
    font-size: x-small !important;    
<br />
}</pre>In case you're wondering, the control renders each result as a DIV inside your
specified element.  The control applies the following styles to your specified
element: 
<br /><pre>border: 1px solid buttonshadow; 
<br />
overflow: hidden; 
<br />
visibility: visible; 
<br />
background-color: window; 
<br />
color: windowtext; 
<br />
cursor: default; 
<br />
width: 130px; 
<br />
position: absolute; 
<br />
left: 184px; 
<br />
top: 27px; 
<br />
display: inline;<br /></pre><p>
You can override whichever ones you want by applying the <font color="#008000" face="Courier New">!important</font> attribute
inside the <font color="#008000" face="Courier New">#AutoComplete</font> entry in
the style sheet.  The individual items then can also be styled via the <font color="#008000" face="Courier New">#AutoComplete
div</font> entry, i prefered a slightly smaller font size because the default setting
looked too big.<br /></p><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5773cf51-d088-4afd-b841-f24a0b5d7be7" /></body>
      <title>Problems with the AJAX AutoCompleteExtender (arrgh)</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,5773cf51-d088-4afd-b841-f24a0b5d7be7.aspx</guid>
      <link>http://tim.mackey.ie/ProblemsWithTheAJAXAutoCompleteExtenderArrgh.aspx</link>
      <pubDate>Wed, 29 Nov 2006 16:54:25 GMT</pubDate>
      <description>I was interested to see that &lt;a href="http://ajax.asp.net/"&gt;Atlas/AJAX&lt;/a&gt; has now
made it to Beta 2.&amp;nbsp; I looked at it earlier in the year but didn't have time to
really get stuck in.&amp;nbsp; So today i eventually got it working in conjunction with &lt;a href="http://msdn.microsoft.com/data/ref/linq/"&gt;LINQ&lt;/a&gt;.&amp;nbsp;
I wanted to get a basic AutoComplete thing working off my database, with which i am
hopefully going to use LINQ throughout.&lt;br&gt;
&lt;br&gt;
First of all, go to &lt;a href="http://ajax.asp.net/"&gt;http://ajax.asp.net/&lt;/a&gt; and download
and install the 3 bits they recommend.&amp;nbsp; 
&lt;br&gt;
&lt;h2&gt;Getting the darn thing to work
&lt;/h2&gt;
&lt;a href="http://blogs.msdn.com/brada/default.aspx"&gt;Brad Adams&lt;/a&gt; has a very good
getting-started example &lt;a href="http://blogs.msdn.com/brada/archive/2006/10/27/search-autocomplete-with-asp-net-ajax-extensions.aspx"&gt;on
this post&lt;/a&gt;, i used his article as a starting point, but i had to sort out a few
other things first.&amp;nbsp; i couldn't get any documentation on the AutoCompleteExtender
so i scavenged some crucial facts off the net after a lot of fumbling around, i've
listed these below.&amp;nbsp; One mistake i made was to start testing the AutoComplete
control before making sure that the web service was returning correct data, my LINQ
query was chucking exceptions and the AJAX control doesn't give you any feedback on
exceptions, which is understandable and probably desirable.&lt;a href="http://blogs.msdn.com/brada/default.aspx"&gt;
&lt;br&gt;
&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;
you must mark your web service class with the &lt;font color="#008000" face="Courier New"&gt;[ScriptService] &lt;/font&gt;attribute,
you'll need the &lt;font color="#008000" face="Courier New"&gt;Microsoft.Web.Script.Services&lt;/font&gt; namespace
for this.&lt;br&gt;
&lt;pre&gt;[WebService(Namespace = "http://whatever")]&lt;br&gt;
&lt;b&gt;[ScriptService]&lt;/b&gt;
&lt;br&gt;
public class AjaxService : System.Web.Services.WebService&lt;br&gt;
{ 
&lt;br&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
you need two parameters in your web service method, the naming of the parameters is
crucial: 
&lt;br&gt;
&lt;pre&gt;[WebMethod]&lt;br&gt;
public string[] GetList(string &lt;b&gt;prefixText&lt;/b&gt;, int count)&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
if you're using Linq, and if you're new at it like me, you might have trouble getting
your LINQ query results into a string array for the web service.&amp;nbsp; I tried returning
IEnumerable&amp;lt;TableName&amp;gt; and List&amp;lt;string&amp;gt; etc. but it didn't like that,
i ended up using the ToArray() extended method that is part of System.Query.&amp;nbsp;
Here is the query i used which concatenates some columns from the table into a collection
of strings.&amp;nbsp; 
&lt;br&gt;
&lt;pre&gt;IEnumerable&amp;lt;string&amp;gt; ds =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; from r in MyDataBase.Restaurants&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; where r.RestaurantName.Contains(prefixText)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; select (r.RestaurantName
+ "," + r.Address1 + "," + r.County); // join the name + address in a string&lt;br&gt;
string[] results = ds.ToArray&amp;lt;string&amp;gt;();&lt;br&gt;
return results;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Formatting the AutoCompleteExtender
&lt;/h2&gt;
The control has some nasty hard-coded values, but where there's a will there's a way.&amp;nbsp;
Thanks to the Firefox dom inspector and the CSS !important modifier, all is not lost.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
The control does have a property called CompletionListElementID which specifies the
container element where the results are inserted.&amp;nbsp; I put a simple DIV next to
the textbox:&lt;br&gt;
&lt;pre&gt;&amp;lt;div id="AutoComplete" runat="server"&amp;gt; &amp;lt;/div&amp;gt;&lt;/pre&gt;Then in my stylesheet
i have the following values to override the hard-coded styles set by the control:&lt;br&gt;
&lt;pre&gt;#AutoComplete&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; width: auto !important;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; overflow: visible !important;&lt;br&gt;
}&lt;br&gt;
#AutoComplete div&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; font-size: x-small !important;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
}&lt;/pre&gt;In case you're wondering, the control renders each result as a DIV inside your
specified element.&amp;nbsp; The control applies the following styles to your specified
element: 
&lt;br&gt;
&lt;pre&gt;border: 1px solid buttonshadow; 
&lt;br&gt;
overflow: hidden; 
&lt;br&gt;
visibility: visible; 
&lt;br&gt;
background-color: window; 
&lt;br&gt;
color: windowtext; 
&lt;br&gt;
cursor: default; 
&lt;br&gt;
width: 130px; 
&lt;br&gt;
position: absolute; 
&lt;br&gt;
left: 184px; 
&lt;br&gt;
top: 27px; 
&lt;br&gt;
display: inline;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
You can override whichever ones you want by applying the &lt;font color="#008000" face="Courier New"&gt;!important&lt;/font&gt; attribute
inside the &lt;font color="#008000" face="Courier New"&gt;#AutoComplete&lt;/font&gt; entry in
the style sheet.&amp;nbsp; The individual items then can also be styled via the &lt;font color="#008000" face="Courier New"&gt;#AutoComplete
div&lt;/font&gt; entry, i prefered a slightly smaller font size because the default setting
looked too big.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=5773cf51-d088-4afd-b841-f24a0b5d7be7" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,5773cf51-d088-4afd-b841-f24a0b5d7be7.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=91e8b8f0-e88f-4194-817a-90d5d9a5b869</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,91e8b8f0-e88f-4194-817a-90d5d9a5b869.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,91e8b8f0-e88f-4194-817a-90d5d9a5b869.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=91e8b8f0-e88f-4194-817a-90d5d9a5b869</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i found this insanely difficult because
none of the supposedly normal options worked.  merge modules didn't seem suitable
because i just wanted to install the CR dlls once and for all on the server. 
according to an <a href="http://msdn2.microsoft.com/en-us/library/ms225241.aspx">MSDN2
article</a> i should be able to perform a windows installer deployment, but of course
when i copy the key code from the VS2005 &gt; Help &gt; About dialog, and use it in
the installer on the server, the error message is that the key code has expired or
is invalid.  'business objects' appear to be forcing users into an upgrade path
for their new product, by claiming that a 'compatibility upgrade' is required for
VS 2005, which of course you have to fork out for.  such a load of crap.  
<br />
anyway, what eventually worked for me was to go back into my VS 2005 dev machine and
create a web set up project. go into the project properties and click the prerequisites
button, select CR for .Net 2.0 and then just build the empty setup project. if you
look in your output folder, there is an installation file called CRRedist2005_x86.msi. 
Just whack this onto the server and your crystal reports should run fine, i didn't
need to reboot or restart IIS.  Note there is no also need to copy any of the
CR dlls to your web site bin folder.  
<br /><br />
yet another miserable failure for crystal reports!<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=91e8b8f0-e88f-4194-817a-90d5d9a5b869" /></body>
      <title>HowTo: Deploy Crystal Reports for VS 2005</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,91e8b8f0-e88f-4194-817a-90d5d9a5b869.aspx</guid>
      <link>http://tim.mackey.ie/HowToDeployCrystalReportsForVS2005.aspx</link>
      <pubDate>Sat, 07 Oct 2006 00:32:30 GMT</pubDate>
      <description>i found this insanely difficult because none of the supposedly normal options worked.&amp;nbsp; merge modules didn't seem suitable because i just wanted to install the CR dlls once and for all on the server.&amp;nbsp; according to an &lt;a href="http://msdn2.microsoft.com/en-us/library/ms225241.aspx"&gt;MSDN2
article&lt;/a&gt; i should be able to perform a windows installer deployment, but of course
when i copy the key code from the VS2005 &amp;gt; Help &amp;gt; About dialog, and use it in
the installer on the server, the error message is that the key code has expired or
is invalid.&amp;nbsp; 'business objects' appear to be forcing users into an upgrade path
for their new product, by claiming that a 'compatibility upgrade' is required for
VS 2005, which of course you have to fork out for.&amp;nbsp; such a load of crap.&amp;nbsp; 
&lt;br&gt;
anyway, what eventually worked for me was to go back into my VS 2005 dev machine and
create a web set up project. go into the project properties and click the prerequisites
button, select CR for .Net 2.0 and then just build the empty setup project. if you
look in your output folder, there is an installation file called CRRedist2005_x86.msi.&amp;nbsp;
Just whack this onto the server and your crystal reports should run fine, i didn't
need to reboot or restart IIS.&amp;nbsp; Note there is no also need to copy any of the
CR dlls to your web site bin folder.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
yet another miserable failure for crystal reports!&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=91e8b8f0-e88f-4194-817a-90d5d9a5b869" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,91e8b8f0-e88f-4194-817a-90d5d9a5b869.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=fda02ba7-cfa6-4886-9cd4-ac2459885649</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,fda02ba7-cfa6-4886-9cd4-ac2459885649.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,fda02ba7-cfa6-4886-9cd4-ac2459885649.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=fda02ba7-cfa6-4886-9cd4-ac2459885649</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I encountered this error after upgrading
a web site to VS2005 and converting it to a Web Application Project.  the project
built without problems, it was just the designer kept throwing up errors in the error
list which was very annoying. 
<br /><br />
Thanks to 'ratureus' for his post on http://forums.asp.net/thread/1212425.aspx<br /><br /><ul><li><font size="2">Close VS 2005</font></li><li><font size="2">delete all files in C:\Documents and Settings\yourusername\Application
Data\Microsoft\VisualStudio\8.0\ReflectedSchemas\</font></li><li><font size="2">Restart VS 2005</font></li></ul>
this worked for me.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=fda02ba7-cfa6-4886-9cd4-ac2459885649" /></body>
      <title>FIX: VS2005 Unrecognised tag prefix or device filter</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,fda02ba7-cfa6-4886-9cd4-ac2459885649.aspx</guid>
      <link>http://tim.mackey.ie/FIXVS2005UnrecognisedTagPrefixOrDeviceFilter.aspx</link>
      <pubDate>Wed, 06 Sep 2006 10:50:04 GMT</pubDate>
      <description>I encountered this error after upgrading a web site to VS2005 and converting it to a Web Application Project.&amp;nbsp; the project built without problems, it was just the designer kept throwing up errors in the error list which was very annoying. &lt;br&gt;
&lt;br&gt;
Thanks to 'ratureus' for his post on http://forums.asp.net/thread/1212425.aspx&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font size="2"&gt;Close VS 2005&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="2"&gt;delete all files in C:\Documents and Settings\yourusername\Application
Data\Microsoft\VisualStudio\8.0\ReflectedSchemas\&lt;/font&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;font size="2"&gt;Restart VS 2005&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
this worked for me.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=fda02ba7-cfa6-4886-9cd4-ac2459885649" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,fda02ba7-cfa6-4886-9cd4-ac2459885649.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=981a2655-720e-4945-a7b9-21ac10412351</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,981a2655-720e-4945-a7b9-21ac10412351.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,981a2655-720e-4945-a7b9-21ac10412351.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=981a2655-720e-4945-a7b9-21ac10412351</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I use exported crystal reports in PDF format
on my web site, and i was getting intermittent errors from a small number of users. 
I couldn't reproduce it, and i found a thoroughly excellent article on the problem
at the <a href="http://fluidcomponents.com/PDFView.htm">Fluid Components International</a> web
site.  
<br /><br />
They explain what's going wrong and have some suggestions to fix it.  I suspect
in my case it was a problem with embedding the PDF in an activeX control.  i'll
just redirect users to download the file instead.  
<br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=981a2655-720e-4945-a7b9-21ac10412351" /></body>
      <title>PDF problems: File does not begin with %PDF</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,981a2655-720e-4945-a7b9-21ac10412351.aspx</guid>
      <link>http://tim.mackey.ie/PDFProblemsFileDoesNotBeginWithPDF.aspx</link>
      <pubDate>Tue, 05 Sep 2006 14:29:49 GMT</pubDate>
      <description>I use exported crystal reports in PDF format on my web site, and i was getting intermittent errors from a small number of users.&amp;nbsp; I couldn't reproduce it, and i found a thoroughly excellent article on the problem at the &lt;a href="http://fluidcomponents.com/PDFView.htm"&gt;Fluid
Components International&lt;/a&gt; web site.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
They explain what's going wrong and have some suggestions to fix it.&amp;nbsp; I suspect
in my case it was a problem with embedding the PDF in an activeX control.&amp;nbsp; i'll
just redirect users to download the file instead.&amp;nbsp; 
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=981a2655-720e-4945-a7b9-21ac10412351" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,981a2655-720e-4945-a7b9-21ac10412351.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=54c79572-9d23-4346-b220-352355e587aa</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,54c79572-9d23-4346-b220-352355e587aa.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,54c79572-9d23-4346-b220-352355e587aa.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=54c79572-9d23-4346-b220-352355e587aa</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <a href="http://www.dynamicdrive.com/dynamicindex16/maxlength.htm">http://www.dynamicdrive.com/dynamicindex16/maxlength.htm</a>
        <br />
        <br />
        <pre>&lt;script type="text/javascript"&gt;<br /><br />
/***********************************************<br />
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)<br />
* This notice must stay intact for legal use.<br />
* Visit http://www.dynamicdrive.com/ for full source code<br />
***********************************************/<br /><br />
function ismaxlength(obj){<br />
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""<br />
if (obj.getAttribute &amp;&amp; obj.value.length&gt;mlength)<br />
obj.value=obj.value.substring(0,mlength)<br />
}<br /><br />
&lt;/script&gt;<br /><br /><br />
&lt;textarea <font color="#ff0000">maxlength="40" onkeyup="return ismaxlength(this)"</font>&gt;&lt;/textarea&gt;<br /></pre>
        <p>
        </p>
        <img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=54c79572-9d23-4346-b220-352355e587aa" />
      </body>
      <title>A javascript function to enable MaxLength behaviour for Multiline Textboxes</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,54c79572-9d23-4346-b220-352355e587aa.aspx</guid>
      <link>http://tim.mackey.ie/AJavascriptFunctionToEnableMaxLengthBehaviourForMultilineTextboxes.aspx</link>
      <pubDate>Wed, 30 Aug 2006 16:12:43 GMT</pubDate>
      <description>&lt;a href="http://www.dynamicdrive.com/dynamicindex16/maxlength.htm"&gt;http://www.dynamicdrive.com/dynamicindex16/maxlength.htm&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br&gt;
&lt;br&gt;
/***********************************************&lt;br&gt;
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)&lt;br&gt;
* This notice must stay intact for legal use.&lt;br&gt;
* Visit http://www.dynamicdrive.com/ for full source code&lt;br&gt;
***********************************************/&lt;br&gt;
&lt;br&gt;
function ismaxlength(obj){&lt;br&gt;
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""&lt;br&gt;
if (obj.getAttribute &amp;amp;&amp;amp; obj.value.length&amp;gt;mlength)&lt;br&gt;
obj.value=obj.value.substring(0,mlength)&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;lt;textarea &lt;font color="#ff0000"&gt;maxlength="40" onkeyup="return ismaxlength(this)"&lt;/font&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=54c79572-9d23-4346-b220-352355e587aa" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,54c79572-9d23-4346-b220-352355e587aa.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=2ce605fe-2f10-4308-9798-81b00faf108d</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,2ce605fe-2f10-4308-9798-81b00faf108d.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,2ce605fe-2f10-4308-9798-81b00faf108d.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=2ce605fe-2f10-4308-9798-81b00faf108d</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i took this off <a href="http://en.wikipedia.org/wiki/List_of_countries">Wikipedia</a> and
trimmed it down to plain text for a database.  just posting it here for reference:<br /><br />
You may be more interested in the <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO
official list of countries</a> and their 2-digit codes.<br /><br />
Abkhazia<br />
Afghanistan<br />
SBA Akrotiri and Dhekelia<br />
Åland<br />
Albania<br />
Algeria<br />
American Samoa<br />
Andorra<br />
Angola<br />
Anguilla<br />
Antigua and Barbuda<br />
Argentina<br />
Armenia<br />
Aruba 
<br />
Saint Helena Ascension Island<br />
Australia 
<br />
Austria 
<br />
Azerbaijan 
<br />
The Bahamas 
<br />
Bahrain 
<br />
Bangladesh 
<br />
Barbados 
<br />
Belarus 
<br />
Belgium 
<br />
Belize 
<br />
Benin 
<br />
Bermuda 
<br />
Bhutan 
<br />
Bolivia 
<br />
Bosnia and Herzegovina<br />
Botswana 
<br />
Brazil 
<br />
Brunei 
<br />
Bulgaria 
<br />
Burkina Faso<br />
Burundi<br />
Cambodia 
<br />
Cameroon<br />
Canada<br />
Cape Verde<br />
Cayman Islands<br />
Central African Republic<br />
Chad<br />
Chile<br />
China<br />
Christmas Island 
<br />
Cocos (Keeling) Islands<br />
Colombia<br />
Comoros<br />
Congo<br />
Cook Islands<br />
Costa Rica 
<br />
Côte d'Ivoire<br />
Croatia 
<br />
Cuba 
<br />
Cyprus 
<br />
Czech Republic<br />
Denmark<br />
Djibouti<br />
Dominica<br />
Dominican<br />
Ecuador<br />
Egypt 
<br />
El Salvador 
<br />
Equatorial 
<br />
Eritrea<br />
Estonia 
<br />
Ethiopia<br />
Falkland<br />
Faroe Islands<br />
Fiji 
<br />
Finland 
<br />
France 
<br />
French Polynesia 
<br />
Gabon<br />
Gambia<br />
Georgia<br />
Germany<br />
Ghana 
<br />
Gibraltar 
<br />
Greece 
<br />
Greenland 
<br />
Grenada 
<br />
Guam 
<br />
Guatemala 
<br />
Guernsey 
<br />
Guinea 
<br />
Guinea-Bissau<br />
Guyana 
<br />
Haiti 
<br />
Honduras 
<br />
Hong Kong 
<br />
Hungary 
<br />
Iceland 
<br />
India 
<br />
Indonesia 
<br />
Iran 
<br />
Iraq 
<br />
Ireland<br />
Isle of Man<br />
Israel 
<br />
Italy 
<br />
Jamaica 
<br />
Japan 
<br />
Jersey<br />
Jordan<br />
Kazakhstan 
<br />
Kenya 
<br />
Kiribati 
<br />
North Korea 
<br />
South Korea 
<br />
Kosovo<br />
Kuwait 
<br />
Kyrgyzstan 
<br />
Laos 
<br />
Latvia 
<br />
Lebanon 
<br />
Lesotho 
<br />
Liberia 
<br />
Libya 
<br />
Liechtenstein 
<br />
Lithuania 
<br />
Luxembourg<br />
Macau 
<br />
Macedonia<br />
Madagascar<br />
Malawi 
<br />
Malaysia 
<br />
Maldives 
<br />
Mali 
<br />
Malta<br />
Marshall Islands 
<br />
Mauritania 
<br />
Mauritius 
<br />
Mayotte<br />
Mexico 
<br />
Micronesia 
<br />
Moldova 
<br />
Monaco 
<br />
Mongolia<br />
Montenegro 
<br />
Montserrat 
<br />
Morocco 
<br />
Mozambique<br />
Myanmar 
<br />
Nagorno-Karabakh 
<br />
Namibia 
<br />
Nauru 
<br />
Nepal 
<br />
Netherlands 
<br />
Netherlands Antilles 
<br />
New Caledonia 
<br />
New Zealand 
<br />
Nicaragua 
<br />
Niger 
<br />
Nigeria 
<br />
Niue 
<br />
Norfolk Island 
<br />
Northern Cyprus<br />
Northern Mariana Islands<br />
Norway 
<br />
Oman 
<br />
Pakistan 
<br />
Palau 
<br />
Palestinian 
<br />
Panama 
<br />
Papua New Guinea 
<br />
Paraguay 
<br />
Peru 
<br />
Philippines 
<br />
Pitcairn Islands 
<br />
Poland 
<br />
Portugal 
<br />
Pridnestrovian Moldavian Republic<br />
Puerto Rico<br />
Qatar<br />
Romania 
<br />
Russia 
<br />
Rwanda 
<br />
Saint Helena 
<br />
Saint Kitts and Nevis 
<br />
Saint Lucia 
<br />
Saint Pierre and Miquelon 
<br />
Saint Vincent and the Grenadines<br />
Samoa 
<br />
San Marino 
<br />
São Tomé and Príncipe 
<br />
Saudi Arabia 
<br />
Senegal 
<br />
Serbia 
<br />
Seychelles 
<br />
Sierra Leone 
<br />
Singapore 
<br />
Slovakia 
<br />
Slovenia 
<br />
Solomon Islands 
<br />
Somalia 
<br />
Somaliland<br />
South Africa 
<br />
South Ossetia 
<br />
Spain 
<br />
Sri Lanka 
<br />
Sudan 
<br />
Suriname 
<br />
Svalbard 
<br />
Swaziland 
<br />
Sweden 
<br />
Switzerland 
<br />
Syria 
<br />
Tajikistan 
<br />
Tanzania 
<br />
Thailand 
<br />
East Timor<br />
Togo 
<br />
Tokelau 
<br />
Tonga 
<br />
Trinidad and Tobago<br />
Tristan da Cunha 
<br />
Tunisia 
<br />
Turkey 
<br />
Turkmenistan 
<br />
Turks and Caicos Islands<br />
Tuvalu 
<br />
Uganda 
<br />
Ukraine<br />
United Arab Emirates 
<br />
United Kingdom 
<br />
United States 
<br />
Uruguay 
<br />
Uzbekistan 
<br />
Vanuatu 
<br />
Vatican City 
<br />
Venezuela 
<br />
Vietnam 
<br />
Virgin Islands (British)<br />
Virgin Islands (United States)<br />
Wallis and Futuna<br />
Western Sahara 
<br />
Yemen 
<br />
Zambia 
<br />
Zimbabwe<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=2ce605fe-2f10-4308-9798-81b00faf108d" /></body>
      <title>Global country list</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,2ce605fe-2f10-4308-9798-81b00faf108d.aspx</guid>
      <link>http://tim.mackey.ie/GlobalCountryList.aspx</link>
      <pubDate>Wed, 16 Aug 2006 15:39:04 GMT</pubDate>
      <description>i took this off &lt;a href="http://en.wikipedia.org/wiki/List_of_countries"&gt;Wikipedia&lt;/a&gt; and
trimmed it down to plain text for a database.&amp;nbsp; just posting it here for reference:&lt;br&gt;
&lt;br&gt;
You may be more interested in the &lt;a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html"&gt;ISO
official list of countries&lt;/a&gt; and their 2-digit codes.&lt;br&gt;
&lt;br&gt;
Abkhazia&lt;br&gt;
Afghanistan&lt;br&gt;
SBA Akrotiri and Dhekelia&lt;br&gt;
Åland&lt;br&gt;
Albania&lt;br&gt;
Algeria&lt;br&gt;
American Samoa&lt;br&gt;
Andorra&lt;br&gt;
Angola&lt;br&gt;
Anguilla&lt;br&gt;
Antigua and Barbuda&lt;br&gt;
Argentina&lt;br&gt;
Armenia&lt;br&gt;
Aruba 
&lt;br&gt;
Saint Helena Ascension Island&lt;br&gt;
Australia 
&lt;br&gt;
Austria 
&lt;br&gt;
Azerbaijan 
&lt;br&gt;
The Bahamas 
&lt;br&gt;
Bahrain 
&lt;br&gt;
Bangladesh 
&lt;br&gt;
Barbados 
&lt;br&gt;
Belarus 
&lt;br&gt;
Belgium 
&lt;br&gt;
Belize 
&lt;br&gt;
Benin 
&lt;br&gt;
Bermuda 
&lt;br&gt;
Bhutan 
&lt;br&gt;
Bolivia 
&lt;br&gt;
Bosnia and Herzegovina&lt;br&gt;
Botswana 
&lt;br&gt;
Brazil 
&lt;br&gt;
Brunei 
&lt;br&gt;
Bulgaria 
&lt;br&gt;
Burkina Faso&lt;br&gt;
Burundi&lt;br&gt;
Cambodia 
&lt;br&gt;
Cameroon&lt;br&gt;
Canada&lt;br&gt;
Cape Verde&lt;br&gt;
Cayman Islands&lt;br&gt;
Central African Republic&lt;br&gt;
Chad&lt;br&gt;
Chile&lt;br&gt;
China&lt;br&gt;
Christmas Island 
&lt;br&gt;
Cocos (Keeling) Islands&lt;br&gt;
Colombia&lt;br&gt;
Comoros&lt;br&gt;
Congo&lt;br&gt;
Cook Islands&lt;br&gt;
Costa Rica 
&lt;br&gt;
Côte d'Ivoire&lt;br&gt;
Croatia 
&lt;br&gt;
Cuba 
&lt;br&gt;
Cyprus 
&lt;br&gt;
Czech Republic&lt;br&gt;
Denmark&lt;br&gt;
Djibouti&lt;br&gt;
Dominica&lt;br&gt;
Dominican&lt;br&gt;
Ecuador&lt;br&gt;
Egypt 
&lt;br&gt;
El Salvador 
&lt;br&gt;
Equatorial 
&lt;br&gt;
Eritrea&lt;br&gt;
Estonia 
&lt;br&gt;
Ethiopia&lt;br&gt;
Falkland&lt;br&gt;
Faroe Islands&lt;br&gt;
Fiji 
&lt;br&gt;
Finland 
&lt;br&gt;
France 
&lt;br&gt;
French Polynesia 
&lt;br&gt;
Gabon&lt;br&gt;
Gambia&lt;br&gt;
Georgia&lt;br&gt;
Germany&lt;br&gt;
Ghana 
&lt;br&gt;
Gibraltar 
&lt;br&gt;
Greece 
&lt;br&gt;
Greenland 
&lt;br&gt;
Grenada 
&lt;br&gt;
Guam 
&lt;br&gt;
Guatemala 
&lt;br&gt;
Guernsey 
&lt;br&gt;
Guinea 
&lt;br&gt;
Guinea-Bissau&lt;br&gt;
Guyana 
&lt;br&gt;
Haiti 
&lt;br&gt;
Honduras 
&lt;br&gt;
Hong Kong 
&lt;br&gt;
Hungary 
&lt;br&gt;
Iceland 
&lt;br&gt;
India 
&lt;br&gt;
Indonesia 
&lt;br&gt;
Iran 
&lt;br&gt;
Iraq 
&lt;br&gt;
Ireland&lt;br&gt;
Isle of Man&lt;br&gt;
Israel 
&lt;br&gt;
Italy 
&lt;br&gt;
Jamaica 
&lt;br&gt;
Japan 
&lt;br&gt;
Jersey&lt;br&gt;
Jordan&lt;br&gt;
Kazakhstan 
&lt;br&gt;
Kenya 
&lt;br&gt;
Kiribati 
&lt;br&gt;
North Korea 
&lt;br&gt;
South Korea 
&lt;br&gt;
Kosovo&lt;br&gt;
Kuwait 
&lt;br&gt;
Kyrgyzstan 
&lt;br&gt;
Laos 
&lt;br&gt;
Latvia 
&lt;br&gt;
Lebanon 
&lt;br&gt;
Lesotho 
&lt;br&gt;
Liberia 
&lt;br&gt;
Libya 
&lt;br&gt;
Liechtenstein 
&lt;br&gt;
Lithuania 
&lt;br&gt;
Luxembourg&lt;br&gt;
Macau 
&lt;br&gt;
Macedonia&lt;br&gt;
Madagascar&lt;br&gt;
Malawi 
&lt;br&gt;
Malaysia 
&lt;br&gt;
Maldives 
&lt;br&gt;
Mali 
&lt;br&gt;
Malta&lt;br&gt;
Marshall Islands 
&lt;br&gt;
Mauritania 
&lt;br&gt;
Mauritius 
&lt;br&gt;
Mayotte&lt;br&gt;
Mexico 
&lt;br&gt;
Micronesia 
&lt;br&gt;
Moldova 
&lt;br&gt;
Monaco 
&lt;br&gt;
Mongolia&lt;br&gt;
Montenegro 
&lt;br&gt;
Montserrat 
&lt;br&gt;
Morocco 
&lt;br&gt;
Mozambique&lt;br&gt;
Myanmar 
&lt;br&gt;
Nagorno-Karabakh 
&lt;br&gt;
Namibia 
&lt;br&gt;
Nauru 
&lt;br&gt;
Nepal 
&lt;br&gt;
Netherlands 
&lt;br&gt;
Netherlands Antilles 
&lt;br&gt;
New Caledonia 
&lt;br&gt;
New Zealand 
&lt;br&gt;
Nicaragua 
&lt;br&gt;
Niger 
&lt;br&gt;
Nigeria 
&lt;br&gt;
Niue 
&lt;br&gt;
Norfolk Island 
&lt;br&gt;
Northern Cyprus&lt;br&gt;
Northern Mariana Islands&lt;br&gt;
Norway 
&lt;br&gt;
Oman 
&lt;br&gt;
Pakistan 
&lt;br&gt;
Palau 
&lt;br&gt;
Palestinian 
&lt;br&gt;
Panama 
&lt;br&gt;
Papua New Guinea 
&lt;br&gt;
Paraguay 
&lt;br&gt;
Peru 
&lt;br&gt;
Philippines 
&lt;br&gt;
Pitcairn Islands 
&lt;br&gt;
Poland 
&lt;br&gt;
Portugal 
&lt;br&gt;
Pridnestrovian Moldavian Republic&lt;br&gt;
Puerto Rico&lt;br&gt;
Qatar&lt;br&gt;
Romania 
&lt;br&gt;
Russia 
&lt;br&gt;
Rwanda 
&lt;br&gt;
Saint Helena 
&lt;br&gt;
Saint Kitts and Nevis 
&lt;br&gt;
Saint Lucia 
&lt;br&gt;
Saint Pierre and Miquelon 
&lt;br&gt;
Saint Vincent and the Grenadines&lt;br&gt;
Samoa 
&lt;br&gt;
San Marino 
&lt;br&gt;
São Tomé and Príncipe 
&lt;br&gt;
Saudi Arabia 
&lt;br&gt;
Senegal 
&lt;br&gt;
Serbia 
&lt;br&gt;
Seychelles 
&lt;br&gt;
Sierra Leone 
&lt;br&gt;
Singapore 
&lt;br&gt;
Slovakia 
&lt;br&gt;
Slovenia 
&lt;br&gt;
Solomon Islands 
&lt;br&gt;
Somalia 
&lt;br&gt;
Somaliland&lt;br&gt;
South Africa 
&lt;br&gt;
South Ossetia 
&lt;br&gt;
Spain 
&lt;br&gt;
Sri Lanka 
&lt;br&gt;
Sudan 
&lt;br&gt;
Suriname 
&lt;br&gt;
Svalbard 
&lt;br&gt;
Swaziland 
&lt;br&gt;
Sweden 
&lt;br&gt;
Switzerland 
&lt;br&gt;
Syria 
&lt;br&gt;
Tajikistan 
&lt;br&gt;
Tanzania 
&lt;br&gt;
Thailand 
&lt;br&gt;
East Timor&lt;br&gt;
Togo 
&lt;br&gt;
Tokelau 
&lt;br&gt;
Tonga 
&lt;br&gt;
Trinidad and Tobago&lt;br&gt;
Tristan da Cunha 
&lt;br&gt;
Tunisia 
&lt;br&gt;
Turkey 
&lt;br&gt;
Turkmenistan 
&lt;br&gt;
Turks and Caicos Islands&lt;br&gt;
Tuvalu 
&lt;br&gt;
Uganda 
&lt;br&gt;
Ukraine&lt;br&gt;
United Arab Emirates 
&lt;br&gt;
United Kingdom 
&lt;br&gt;
United States 
&lt;br&gt;
Uruguay 
&lt;br&gt;
Uzbekistan 
&lt;br&gt;
Vanuatu 
&lt;br&gt;
Vatican City 
&lt;br&gt;
Venezuela 
&lt;br&gt;
Vietnam 
&lt;br&gt;
Virgin Islands (British)&lt;br&gt;
Virgin Islands (United States)&lt;br&gt;
Wallis and Futuna&lt;br&gt;
Western Sahara 
&lt;br&gt;
Yemen 
&lt;br&gt;
Zambia 
&lt;br&gt;
Zimbabwe&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=2ce605fe-2f10-4308-9798-81b00faf108d" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,2ce605fe-2f10-4308-9798-81b00faf108d.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=56c0211a-9d04-494d-b5ed-3e963011e14f</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,56c0211a-9d04-494d-b5ed-3e963011e14f.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,56c0211a-9d04-494d-b5ed-3e963011e14f.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=56c0211a-9d04-494d-b5ed-3e963011e14f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I have a few reports in my web application
that i export in PDF format only.  You would think this would remove any printer
driver complications but apparently not. 
<br />
Crystal Reports have a <a href="http://support.businessobjects.com/communityCS/TechnicalPapers/cr_printer_driver_options.pdf?ref=devzone_reporting_main">surprisingly
good article</a> to help troubleshoot issues with printing or exporting a report. 
<br /><br />
The problem i was finding was that in a Text object or Unbound field, the text would
be truncated at the edge of the box boundary.  Some users have reported strange
mid-word wrapping, but mine was a different problem, actually hacking off the end
of each line.  This didn't happen on my dev machine, but it did happen on the
server (2003).  When i compared them side by side, the Times New Roman font on
the server was stretched by about 5% compared to my dev machine. 
<br />
with the help of the CR article, i tracked it down to the lack of any printer installed
on the server, i had also disabled the Print Spooler service which was preventing
even the Microsoft Office Document Imaging Printer from being available.  So
i started the print spooler service and made sure that the Office Imaging Printer
was marked as the default printer.  Then i went back to Visual Studio and set
all the reports to use the Office Imaging printer.  This solved the problem.  
<br /><br />
You could of course install a PDF only printer such as PrimoPDF if you didn't have
MS office installed on the server. As long as the server has the same printer installed
as the one set in the report design, everything turns out fine.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=56c0211a-9d04-494d-b5ed-3e963011e14f" /></body>
      <title>Crystal Reports: Export PDF irregularities between server and dev machine</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,56c0211a-9d04-494d-b5ed-3e963011e14f.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsExportPDFIrregularitiesBetweenServerAndDevMachine.aspx</link>
      <pubDate>Fri, 11 Aug 2006 12:20:57 GMT</pubDate>
      <description>I have a few reports in my web application that i export in PDF format only.&amp;nbsp; You would think this would remove any printer driver complications but apparently not. &lt;br&gt;
Crystal Reports have a &lt;a href="http://support.businessobjects.com/communityCS/TechnicalPapers/cr_printer_driver_options.pdf?ref=devzone_reporting_main"&gt;surprisingly
good article&lt;/a&gt; to help troubleshoot issues with printing or exporting a report. 
&lt;br&gt;
&lt;br&gt;
The problem i was finding was that in a Text object or Unbound field, the text would
be truncated at the edge of the box boundary.&amp;nbsp; Some users have reported strange
mid-word wrapping, but mine was a different problem, actually hacking off the end
of each line.&amp;nbsp; This didn't happen on my dev machine, but it did happen on the
server (2003).&amp;nbsp; When i compared them side by side, the Times New Roman font on
the server was stretched by about 5% compared to my dev machine. 
&lt;br&gt;
with the help of the CR article, i tracked it down to the lack of any printer installed
on the server, i had also disabled the Print Spooler service which was preventing
even the Microsoft Office Document Imaging Printer from being available.&amp;nbsp; So
i started the print spooler service and made sure that the Office Imaging Printer
was marked as the default printer.&amp;nbsp; Then i went back to Visual Studio and set
all the reports to use the Office Imaging printer.&amp;nbsp; This solved the problem.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
You could of course install a PDF only printer such as PrimoPDF if you didn't have
MS office installed on the server. As long as the server has the same printer installed
as the one set in the report design, everything turns out fine.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=56c0211a-9d04-494d-b5ed-3e963011e14f" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,56c0211a-9d04-494d-b5ed-3e963011e14f.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I was getting blank fields in my crystal
report if one of the values in the formula was null. 
<br />
Thanks to <a href="http://groups.google.com/group/microsoft.public.vb.crystal/browse_frm/thread/a3dbce66126297ac/e872132608e048a0?lnk=st&amp;q=&amp;rnum=8#e872132608e048a0">this
post</a> i know better than to trust Crystal's crummy concatenation rules.  Here
is what <span class="msghv"><b><font class="inheritcolor" color="#790619"> Gundula
Wangerin</font></b></span> had to say:<br /><blockquote>A string concatenated with null always gives null. 
<br />
You have to check if the first name is null with 
<br /><pre>     if not IsNull(firstname) then 
<br />
        lastname + " " + firstname 
<br />
    else 
<br />
        lastname </pre></blockquote><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb" /></body>
      <title>Crystal Reports: join / concatenate null strings</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsJoinConcatenateNullStrings.aspx</link>
      <pubDate>Thu, 10 Aug 2006 16:31:20 GMT</pubDate>
      <description>I was getting blank fields in my crystal report if one of the values in the formula was null. &lt;br&gt;
Thanks to &lt;a href="http://groups.google.com/group/microsoft.public.vb.crystal/browse_frm/thread/a3dbce66126297ac/e872132608e048a0?lnk=st&amp;amp;q=&amp;amp;rnum=8#e872132608e048a0"&gt;this
post&lt;/a&gt; i know better than to trust Crystal's crummy concatenation rules.&amp;nbsp; Here
is what &lt;span class="msghv"&gt;&lt;b&gt;&lt;font class="inheritcolor" color="#790619"&gt; Gundula
Wangerin&lt;/font&gt;&lt;/b&gt;&lt;/span&gt; had to say:&lt;br&gt;
&lt;blockquote&gt;A string concatenated with null always gives null. 
&lt;br&gt;
You have to check if the first name is null with 
&lt;br&gt;
&lt;pre&gt; &amp;nbsp; &amp;nbsp; if not IsNull(firstname) then 
&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastname + " " + firstname 
&lt;br&gt;
&amp;nbsp; &amp;nbsp; else 
&lt;br&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastname &lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,922f2ec5-bf8a-4517-95a3-1cc8fbd8f2eb.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=69ff0d0c-1179-447a-8270-2d3968bb2839</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,69ff0d0c-1179-447a-8270-2d3968bb2839.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,69ff0d0c-1179-447a-8270-2d3968bb2839.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=69ff0d0c-1179-447a-8270-2d3968bb2839</wfw:commentRss>
      <slash:comments>9</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I picked up a tip on the Internet to display
a "No records" message if the report contains no records, rather than leaving the
user with an empty screen.  Simply Format the text field and enter a formula
next to 'Suppress' with something like 
<br /><pre>Count({Table.Field}) &gt; 0</pre>This will suppress (hide) the message if there
are records in the report.<br /><br /><p></p>
I tried using a similar approach to hide a text field when there are no records, so
it is essentially the same thing in reverse.  You would think a simple formula
on the 'suppress' property this would achieve the desired effect:<br /><pre>Count({Table.Field}) = 0<br /></pre><p>
But apparently the value returned by Count can be null if there are no records. 
so you have to use: 
<br /></p><pre>IsNull(Count({Table.Field})) OR Count({Table.Field}) = 0</pre><p>
This is just another crystal reports annoyance, of which there are many.<br /></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=69ff0d0c-1179-447a-8270-2d3968bb2839" /></body>
      <title>Crystal Reports: Suppress doesn't work for Count(x) = 0</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,69ff0d0c-1179-447a-8270-2d3968bb2839.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsSuppressDoesntWorkForCountx0.aspx</link>
      <pubDate>Fri, 04 Aug 2006 10:26:38 GMT</pubDate>
      <description>I picked up a tip on the Internet to display a "No records" message if the report contains no records, rather than leaving the user with an empty screen.&amp;nbsp; Simply Format the text field and enter a formula next to 'Suppress' with something like &lt;br&gt;
&lt;pre&gt;Count({Table.Field}) &amp;gt; 0&lt;/pre&gt;This will suppress (hide) the message if there
are records in the report.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
I tried using a similar approach to hide a text field when there are no records, so
it is essentially the same thing in reverse.&amp;nbsp; You would think a simple formula
on the 'suppress' property this would achieve the desired effect:&lt;br&gt;
&lt;pre&gt;Count({Table.Field}) = 0&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
But apparently the value returned by Count can be null if there are no records.&amp;nbsp;
so you have to use: 
&lt;br&gt;
&lt;/p&gt;
&lt;pre&gt;IsNull(Count({Table.Field})) OR Count({Table.Field}) = 0&lt;/pre&gt;
&lt;p&gt;
This is just another crystal reports annoyance, of which there are many.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=69ff0d0c-1179-447a-8270-2d3968bb2839" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,69ff0d0c-1179-447a-8270-2d3968bb2839.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=e2022f27-3251-4169-a2e1-571f61b97cd2</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,e2022f27-3251-4169-a2e1-571f61b97cd2.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,e2022f27-3251-4169-a2e1-571f61b97cd2.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=e2022f27-3251-4169-a2e1-571f61b97cd2</wfw:commentRss>
      <slash:comments>12</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i'm part of the dd/MM/yyyy world, and that
often means running into problems when using software developed with MM/dd/yyyy defaults,
such as crystal reports.  
<br />
i have all the report options set to use the system defaults, which are regionally
set to ireland in windows, but that isn't enough, the dates still come out in MM/dd/yyyy
format.  i have the date + date/time fields customised within crystal reports
to dd/MM/yyyy but that isn't enough either.  with lots of hours googling and
no answers that worked, i resorted to searching the registry and found that some of
the user accounts were still using US regional settings.  If you look in HKEY_USERS
&gt; you see a list of all the account IDs on the computer.  My guess is that
crystal reports must use the SYSTEM account or another non-interactive account, and
it takes the regional settings from there.  So if you search for sShortDate in
the registry, you will find all the appropriate settings and can replace the MM/dd/yyyy
values with your preferred format. 
<br />
i had to reboot to get it to take effect.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=e2022f27-3251-4169-a2e1-571f61b97cd2" /></body>
      <title>Crystal Reports: not picking up correct date format</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,e2022f27-3251-4169-a2e1-571f61b97cd2.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsNotPickingUpCorrectDateFormat.aspx</link>
      <pubDate>Wed, 02 Aug 2006 19:45:07 GMT</pubDate>
      <description>i'm part of the dd/MM/yyyy world, and that often means running into problems when using software developed with MM/dd/yyyy defaults, such as crystal reports.&amp;nbsp; &lt;br&gt;
i have all the report options set to use the system defaults, which are regionally
set to ireland in windows, but that isn't enough, the dates still come out in MM/dd/yyyy
format.&amp;nbsp; i have the date + date/time fields customised within crystal reports
to dd/MM/yyyy but that isn't enough either.&amp;nbsp; with lots of hours googling and
no answers that worked, i resorted to searching the registry and found that some of
the user accounts were still using US regional settings.&amp;nbsp; If you look in HKEY_USERS
&amp;gt; you see a list of all the account IDs on the computer.&amp;nbsp; My guess is that
crystal reports must use the SYSTEM account or another non-interactive account, and
it takes the regional settings from there.&amp;nbsp; So if you search for sShortDate in
the registry, you will find all the appropriate settings and can replace the MM/dd/yyyy
values with your preferred format. 
&lt;br&gt;
i had to reboot to get it to take effect.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=e2022f27-3251-4169-a2e1-571f61b97cd2" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,e2022f27-3251-4169-a2e1-571f61b97cd2.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=462ecab5-18b8-4f6e-90c2-dd4c6a682996</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,462ecab5-18b8-4f6e-90c2-dd4c6a682996.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,462ecab5-18b8-4f6e-90c2-dd4c6a682996.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=462ecab5-18b8-4f6e-90c2-dd4c6a682996</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i ran into a problem with my Crystal Reports. 
instead of using the usual Typed Dataset approach, where you use Report.SetDataSource(DataSet),
i decided that was too much hastle and it seems faster and simpler just to design
the query in the Crystal Reports 'wizard', and then supply parameters and set the
record filter appropriately.  what i didn't know was that it was insanely complicated
to direct the report to a different database path at runtime (such as most users would
have in their deployment environment, whether for Access or SQL server).  
<br /><br />
i was using Report.SetDataBaseLogon("admin", "") etc and all sorts of variations but
none of them were working.  I kept getting <i><b>Logon Failed</b></i> exceptions. 
Apparently you need to iterate through each table used in the report and set the source
database for each one.  Not only that, but neither of the following lines of
code has any effect:<br /><pre>Report.Database.Tables[i].SetDataSource("admin", "", DbPath, "")<br />
Report.Database.Tables[i].LogOnInfo.ConnectionInfo.ServerName = DbPath</pre>apparently
you have to create a TableLogOnInfo object and use ApplyLogOnInfo() with that on each
table.  
<br />
here is what does work:<br /><pre>TableLogOnInfo t = new TableLogOnInfo();<br />
t.ConnectionInfo.ServerName = dbPath;          
 <br />
for(int i=0; i&lt;rpt.Database.Tables.Count; i++)<br />
    rpt.Database.Tables[i].ApplyLogOnInfo(t);</pre><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=462ecab5-18b8-4f6e-90c2-dd4c6a682996" /></body>
      <title>Crystal Reports: problems changing database connection at run time</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,462ecab5-18b8-4f6e-90c2-dd4c6a682996.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsProblemsChangingDatabaseConnectionAtRunTime.aspx</link>
      <pubDate>Thu, 27 Jul 2006 15:31:47 GMT</pubDate>
      <description>i ran into a problem with my Crystal Reports.&amp;nbsp; instead of using the usual Typed Dataset approach, where you use Report.SetDataSource(DataSet), i decided that was too much hastle and it seems faster and simpler just to design the query in the Crystal Reports 'wizard', and then supply parameters and set the record filter appropriately.&amp;nbsp; what i didn't know was that it was insanely complicated to direct the report to a different database path at runtime (such as most users would have in their deployment environment, whether for Access or SQL server).&amp;nbsp; &lt;br&gt;
&lt;br&gt;
i was using Report.SetDataBaseLogon("admin", "") etc and all sorts of variations but
none of them were working.&amp;nbsp; I kept getting &lt;i&gt;&lt;b&gt;Logon Failed&lt;/b&gt;&lt;/i&gt; exceptions.&amp;nbsp;
Apparently you need to iterate through each table used in the report and set the source
database for each one.&amp;nbsp; Not only that, but neither of the following lines of
code has any effect:&lt;br&gt;
&lt;pre&gt;Report.Database.Tables[i].SetDataSource("admin", "", DbPath, "")&lt;br&gt;
Report.Database.Tables[i].LogOnInfo.ConnectionInfo.ServerName = DbPath&lt;/pre&gt;apparently
you have to create a TableLogOnInfo object and use ApplyLogOnInfo() with that on each
table.&amp;nbsp; 
&lt;br&gt;
here is what does work:&lt;br&gt;
&lt;pre&gt;TableLogOnInfo t = new TableLogOnInfo();&lt;br&gt;
t.ConnectionInfo.ServerName = dbPath;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&lt;br&gt;
for(int i=0; i&amp;lt;rpt.Database.Tables.Count; i++)&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;rpt.Database.Tables[i].ApplyLogOnInfo(t);&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=462ecab5-18b8-4f6e-90c2-dd4c6a682996" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,462ecab5-18b8-4f6e-90c2-dd4c6a682996.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=3bcf2258-413f-4f50-9c17-116c8e75906d</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,3bcf2258-413f-4f50-9c17-116c8e75906d.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,3bcf2258-413f-4f50-9c17-116c8e75906d.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=3bcf2258-413f-4f50-9c17-116c8e75906d</wfw:commentRss>
      <slash:comments>16</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">if you're like me and use the onbeforeunload
event in a web page to display a reminder to a user who might unintentially lose work
by browsing away from the page, then you might be trying to find a way to cancel the
event in the case where the user clicks the save button (they obviously don't need
reminding now that they have clicked the button...)<br /><br />
on the internet you will find many people suggesting you use something like<br /><pre>window.onbeforeunload = null</pre>but this does not work for me in IE6. 
reading up in the MSDN docs for the event object i found a reference to the event.cancelBubble
property, which i thought was the solution. but thanks to Orso who pointed out that
setting "event.cancelBubble=true" is useless, the way to get rid of the confirm prompt
is to exclude the return statement altogether, i chose to use a boolean variable as
a flag to decide whether to return something or not. in the example below i add the
javascript code programattically in the code behind:<br /><br /><pre>	Page.ClientScript.RegisterStartupScript(typeof(String), "ConfirmClose", @"<br />
&lt;script&gt;<br />
window.onbeforeunload = confirmExit;<br />
function confirmExit()<br />
{<br />
if(postback == false)<br />
return ""Please don't leave this page without clicking the 'Save Changes' or 'Discard
Changes' buttons.""; 
<br />
} 
<br />
&lt;/script&gt;");<br /><br /></pre>then my save button contains the following aspx markup:<br /><pre>    OnClientClick="postback=true;return true;"</pre>this sets
the 'postback' variable to true, which gets picked up in the confirmExit() function,
having the effect of cancelling the event.  
<br /><br />
hope you find this useful.  it is tested and works in IE6 and FF 1.5.0.2.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=3bcf2258-413f-4f50-9c17-116c8e75906d" /></body>
      <title>HowTo: cancel an onbeforeunload event</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,3bcf2258-413f-4f50-9c17-116c8e75906d.aspx</guid>
      <link>http://tim.mackey.ie/HowToCancelAnOnbeforeunloadEvent.aspx</link>
      <pubDate>Mon, 24 Apr 2006 16:10:13 GMT</pubDate>
      <description>if you're like me and use the onbeforeunload event in a web page to display a reminder to a user who might unintentially lose work by browsing away from the page, then you might be trying to find a way to cancel the event in the case where the user clicks the save button (they obviously don't need reminding now that they have clicked the button...)&lt;br&gt;
&lt;br&gt;
on the internet you will find many people suggesting you use something like&lt;br&gt;
&lt;pre&gt;window.onbeforeunload = null&lt;/pre&gt;but this does not work for me in IE6.&amp;nbsp;
reading up in the MSDN docs for the event object i found a reference to the event.cancelBubble
property, which i thought was the solution. but thanks to Orso who pointed out that
setting "event.cancelBubble=true" is useless, the way to get rid of the confirm prompt
is to exclude the return statement altogether, i chose to use a boolean variable as
a flag to decide whether to return something or not. in the example below i add the
javascript code programattically in the code behind:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;	Page.ClientScript.RegisterStartupScript(typeof(String), "ConfirmClose", @"&lt;br&gt;
&amp;lt;script&amp;gt;&lt;br&gt;
window.onbeforeunload = confirmExit;&lt;br&gt;
function confirmExit()&lt;br&gt;
{&lt;br&gt;
if(postback == false)&lt;br&gt;
return ""Please don't leave this page without clicking the 'Save Changes' or 'Discard
Changes' buttons.""; 
&lt;br&gt;
} 
&lt;br&gt;
&amp;lt;/script&amp;gt;");&lt;br&gt;
&lt;br&gt;
&lt;/pre&gt;then my save button contains the following aspx markup:&lt;br&gt;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OnClientClick="postback=true;return true;"&lt;/pre&gt;this sets
the 'postback' variable to true, which gets picked up in the confirmExit() function,
having the effect of cancelling the event.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
hope you find this useful.&amp;nbsp; it is tested and works in IE6 and FF 1.5.0.2.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=3bcf2258-413f-4f50-9c17-116c8e75906d" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,3bcf2258-413f-4f50-9c17-116c8e75906d.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=8756e6ca-0c7c-4408-8f22-901acdf31988</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,8756e6ca-0c7c-4408-8f22-901acdf31988.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,8756e6ca-0c7c-4408-8f22-901acdf31988.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=8756e6ca-0c7c-4408-8f22-901acdf31988</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">my aspx page uses a master page, so all
the content is inside a ContentPlaceHolder.  
<br />
aparently Page.FindControl() only works within a single container, which is really
poor functionality if you ask me.  
<br />
to complicate the situation further, my aspx page has dynamic controls inside a Panel.  
<br />
in order to access the controls of my user control, from the code-behind of the page,
i first had to find the panel and then the user control, and then i could finally
use that to find the controls i wanted.  
<br />
note: you don't have to use the client ID of the control ...ctrl00_blah_blah_blah_YourControlName...
when you use the above method, you just use the name of the control, e.g. txtFirstName.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=8756e6ca-0c7c-4408-8f22-901acdf31988" /></body>
      <title>FindControl() won't find the control....</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,8756e6ca-0c7c-4408-8f22-901acdf31988.aspx</guid>
      <link>http://tim.mackey.ie/FindControlWontFindTheControl.aspx</link>
      <pubDate>Wed, 12 Apr 2006 14:27:51 GMT</pubDate>
      <description>my aspx page uses a master page, so all the content is inside a ContentPlaceHolder.&amp;nbsp; &lt;br&gt;
aparently Page.FindControl() only works within a single container, which is really
poor functionality if you ask me.&amp;nbsp; 
&lt;br&gt;
to complicate the situation further, my aspx page has dynamic controls inside a Panel.&amp;nbsp; 
&lt;br&gt;
in order to access the controls of my user control, from the code-behind of the page,
i first had to find the panel and then the user control, and then i could finally
use that to find the controls i wanted.&amp;nbsp; 
&lt;br&gt;
note: you don't have to use the client ID of the control ...ctrl00_blah_blah_blah_YourControlName...
when you use the above method, you just use the name of the control, e.g. txtFirstName.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=8756e6ca-0c7c-4408-8f22-901acdf31988" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,8756e6ca-0c7c-4408-8f22-901acdf31988.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=501a1c0a-bee8-48b0-8926-ee165bd0644b</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,501a1c0a-bee8-48b0-8926-ee165bd0644b.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,501a1c0a-bee8-48b0-8926-ee165bd0644b.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=501a1c0a-bee8-48b0-8926-ee165bd0644b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I wanted to install my web application
assembly into the GAC, but this is made more complicated by the multitude of assemblies
produced by VS when i publish the web site.  On the newsgroups, i found some
talk of a tool called Merge_Aspnet.exe but i couldn't find it anywhere.  Eventually
i found it as a download on MSDN, it is bundled as part of the <a href="http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx">Web
Deployment Projects</a>.  You install it, and then right-click your project in
VS and you should see a new menu item "Add Web Deployment Project".  I am baffled
as to why they didn't just add a new project type in the list of projects under "Deployment". 
There is a link to "Search online templates" so i think it should really be available
there.  but it looks like MS did a hack just to add in a new item to the project
context menu.  but it works... so i'll stop complaining.  
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=501a1c0a-bee8-48b0-8926-ee165bd0644b" /></body>
      <title>Compiling Asp.Net 2.0 to a single assembly</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,501a1c0a-bee8-48b0-8926-ee165bd0644b.aspx</guid>
      <link>http://tim.mackey.ie/CompilingAspNet20ToASingleAssembly.aspx</link>
      <pubDate>Fri, 03 Mar 2006 15:43:20 GMT</pubDate>
      <description>I wanted to install my web application assembly into the GAC, but this is made more complicated by the multitude of assemblies produced by VS when i publish the web site.&amp;nbsp; On the newsgroups, i found some talk of a tool called Merge_Aspnet.exe but i couldn't find it anywhere.&amp;nbsp; Eventually i found it as a download on MSDN, it is bundled as part of the &lt;a href="http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx"&gt;Web
Deployment Projects&lt;/a&gt;.&amp;nbsp; You install it, and then right-click your project in
VS and you should see a new menu item "Add Web Deployment Project".&amp;nbsp; I am baffled
as to why they didn't just add a new project type in the list of projects under "Deployment".&amp;nbsp;
There is a link to "Search online templates" so i think it should really be available
there.&amp;nbsp; but it looks like MS did a hack just to add in a new item to the project
context menu.&amp;nbsp; but it works... so i'll stop complaining.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=501a1c0a-bee8-48b0-8926-ee165bd0644b" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,501a1c0a-bee8-48b0-8926-ee165bd0644b.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=bd94977d-7e41-4f32-9c62-177df5dfcf26</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,bd94977d-7e41-4f32-9c62-177df5dfcf26.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,bd94977d-7e41-4f32-9c62-177df5dfcf26.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=bd94977d-7e41-4f32-9c62-177df5dfcf26</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">In a web application i'm working on, i
needed to get write access to a folder, and preferably not the temp folder because
the data should be kept reasonably safe from being deleted accidentally.  If
it was a windows-forms application this would be easy, i would just use Application.UserAppDataPath. 
So i thought for asp.net, i could use Environment.SpecialFolder.ApplicationData but
this maps to the folder for the current user logged on to Windows, not the process
running the web site, or the authenticated web site user.  So i just skip up
2 parent directories from that, and use the current Principal.WindowsIdentity to find
the actual process running ASP.NET, and then deduce the correct folder, which by default
will have write permissions for Asp.Net.<br /><br />
Here is the code:<br /><pre>string Username = Path.GetFileName(System.Security.Principal.WindowsIdentity.GetCurrent().Name).Replace(" ", "");<br />
string UserAppFolder = String.Format(@"{0}\{1}\Application Data", Directory.GetParent(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName).FullName,
Username);<br /></pre><p>
By the way, the use of Path.GetFileName is entirely intentional, it solves the case
where the current user is "NT Authority\Network Service" by yielding "Network Service",
which is what we are interested in.  
</p>
This will hopefully come in handy for my 'zero configuration' idea for the application. 
Next time you need a write folder, it may be a good idea to use this instead of making
users specify write permissions for a custom folder.  
<br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=bd94977d-7e41-4f32-9c62-177df5dfcf26" /></body>
      <title>HowTo: Get Write Access to an ApplicationData folder in ASP.NET</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,bd94977d-7e41-4f32-9c62-177df5dfcf26.aspx</guid>
      <link>http://tim.mackey.ie/HowToGetWriteAccessToAnApplicationDataFolderInASPNET.aspx</link>
      <pubDate>Sat, 18 Feb 2006 19:11:26 GMT</pubDate>
      <description>In a web application i'm working on, i needed to get write access to a folder, and preferably not the temp folder because the data should be kept reasonably safe from being deleted accidentally.&amp;nbsp; If it was a windows-forms application this would be easy, i would just use Application.UserAppDataPath.&amp;nbsp; So i thought for asp.net, i could use Environment.SpecialFolder.ApplicationData but this maps to the folder for the current user logged on to Windows, not the process running the web site, or the authenticated web site user.&amp;nbsp; So i just skip up 2 parent directories from that, and use the current Principal.WindowsIdentity to find the actual process running ASP.NET, and then deduce the correct folder, which by default will have write permissions for Asp.Net.&lt;br&gt;
&lt;br&gt;
Here is the code:&lt;br&gt;
&lt;pre&gt;string Username = Path.GetFileName(System.Security.Principal.WindowsIdentity.GetCurrent().Name).Replace(" ", "");&lt;br&gt;
string UserAppFolder = String.Format(@"{0}\{1}\Application Data", Directory.GetParent(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName).FullName,
Username);&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
By the way, the use of Path.GetFileName is entirely intentional, it solves the case
where the current user is "NT Authority\Network Service" by yielding "Network Service",
which is what we are interested in.&amp;nbsp;&amp;nbsp;
&lt;/p&gt;
This will hopefully come in handy for my 'zero configuration' idea for the application.&amp;nbsp;
Next time you need a write folder, it may be a good idea to use this instead of making
users specify write permissions for a custom folder.&amp;nbsp; 
&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=bd94977d-7e41-4f32-9c62-177df5dfcf26" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,bd94977d-7e41-4f32-9c62-177df5dfcf26.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=ef06b347-51a0-4824-b2d7-a831c8620588</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,ef06b347-51a0-4824-b2d7-a831c8620588.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,ef06b347-51a0-4824-b2d7-a831c8620588.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=ef06b347-51a0-4824-b2d7-a831c8620588</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">For some reason i can't get SelectNodes
to work with the IIS 6 MetaBase.xml file.  It just doesn't return any matches. 
I think the structure may be non-standard or too complex, or else i'm not using it
right.  but in any case, I worked around the problem by opening the file with
File.OpenText and using Regex to parse out the nodes i'm interested in, namely the
IISWebServer nodes.<br /><br /><pre>string MetaBase = "";<br />
using(StreamReader sr = File.OpenText(ConfigurationManager.AppSettings["MetaBasePath"].ToString()))<br />
MetaBase = sr.ReadToEnd();<br /><br />
foreach(Match m in new Regex(@"(?x:)&lt;IIsWebServer[^&gt;]*&gt;.*?&lt;/IIsWebServer&gt;",
RegexOptions.IgnoreCase).Matches(MetaBase))<br />
{<br />
XmlDocument doc = new XmlDocument();<br />
string IisCode = "", ServerBindings = "", ServerComment = "";<br />
doc.LoadXml(m.Groups[0].Value);<br />
XmlElement node = doc.DocumentElement;<br />
// now you can access the node attributes<br />
...<br /></pre><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=ef06b347-51a0-4824-b2d7-a831c8620588" /></body>
      <title>Using Xml DOM with MetaBase.xml</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,ef06b347-51a0-4824-b2d7-a831c8620588.aspx</guid>
      <link>http://tim.mackey.ie/UsingXmlDOMWithMetaBasexml.aspx</link>
      <pubDate>Thu, 02 Feb 2006 13:38:34 GMT</pubDate>
      <description>For some reason i can't get SelectNodes to work with the IIS 6 MetaBase.xml file.&amp;nbsp; It just doesn't return any matches.&amp;nbsp; I think the structure may be non-standard or too complex, or else i'm not using it right.&amp;nbsp; but in any case, I worked around the problem by opening the file with File.OpenText and using Regex to parse out the nodes i'm interested in, namely the IISWebServer nodes.&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;string MetaBase = "";&lt;br&gt;
using(StreamReader sr = File.OpenText(ConfigurationManager.AppSettings["MetaBasePath"].ToString()))&lt;br&gt;
MetaBase = sr.ReadToEnd();&lt;br&gt;
&lt;br&gt;
foreach(Match m in new Regex(@"(?x:)&amp;lt;IIsWebServer[^&amp;gt;]*&amp;gt;.*?&amp;lt;/IIsWebServer&amp;gt;",
RegexOptions.IgnoreCase).Matches(MetaBase))&lt;br&gt;
{&lt;br&gt;
XmlDocument doc = new XmlDocument();&lt;br&gt;
string IisCode = "", ServerBindings = "", ServerComment = "";&lt;br&gt;
doc.LoadXml(m.Groups[0].Value);&lt;br&gt;
XmlElement node = doc.DocumentElement;&lt;br&gt;
// now you can access the node attributes&lt;br&gt;
...&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=ef06b347-51a0-4824-b2d7-a831c8620588" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,ef06b347-51a0-4824-b2d7-a831c8620588.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
      <category>Windows Server 2003</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=16935d2b-8c4c-4594-93a4-b718401d8252</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,16935d2b-8c4c-4594-93a4-b718401d8252.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,16935d2b-8c4c-4594-93a4-b718401d8252.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=16935d2b-8c4c-4594-93a4-b718401d8252</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <pre>&lt;script language="javascript" type="text/javascript"&gt;<br />
function Select(Select)<br />
{<br />
for (var n=0; n &lt; document.forms[0].length; n++)<br />
if (document.forms[0].elements[n].type=='checkbox')<br />
document.forms[0].elements[n].checked=Select;<br />
return false; 
<br />
}<br />
&lt;/script&gt;<br /><br /><br />
Select &lt;a href="#" onclick="javascript:Select(true)"&gt;All&lt;/a&gt; | &lt;a href="#"
onclick="javascript:Select(false)"&gt;None&lt;/a&gt;<br /><br /></pre>
        <img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=16935d2b-8c4c-4594-93a4-b718401d8252" />
      </body>
      <title>CheckBoxList: Select All / None client-side script</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,16935d2b-8c4c-4594-93a4-b718401d8252.aspx</guid>
      <link>http://tim.mackey.ie/CheckBoxListSelectAllNoneClientsideScript.aspx</link>
      <pubDate>Thu, 02 Feb 2006 13:25:33 GMT</pubDate>
      <description>&lt;pre&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br&gt;
function Select(Select)&lt;br&gt;
{&lt;br&gt;
for (var n=0; n &amp;lt; document.forms[0].length; n++)&lt;br&gt;
if (document.forms[0].elements[n].type=='checkbox')&lt;br&gt;
document.forms[0].elements[n].checked=Select;&lt;br&gt;
return false; 
&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Select &amp;lt;a href="#" onclick="javascript:Select(true)"&amp;gt;All&amp;lt;/a&amp;gt; | &amp;lt;a href="#"
onclick="javascript:Select(false)"&amp;gt;None&amp;lt;/a&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/pre&gt;&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=16935d2b-8c4c-4594-93a4-b718401d8252" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,16935d2b-8c4c-4594-93a4-b718401d8252.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=07553b32-4444-49a2-a4b2-3b84b1283e21</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,07553b32-4444-49a2-a4b2-3b84b1283e21.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,07553b32-4444-49a2-a4b2-3b84b1283e21.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=07553b32-4444-49a2-a4b2-3b84b1283e21</wfw:commentRss>
      <slash:comments>13</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">i kept getting these sporadic error messages
on my web applications and i could never figure out why.  
<br /><pre>Unable to validate data at<br />
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32
start, Int32 length, Int32&amp; dataLength) at 
<br />
System.Web.UI.LosFormatter.Deserialize(String input)</pre>searching the net just reveals
a troop of similarly frustrated users without solutions.  but today i found the
actual reason why, and the work-around. 
<br />
this excellent <a href="http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21321364.html">post
on experts-exchange</a> has the answer.  apparently it happens when users leave
a page open for a long time, and then cause a post back.  something to do with
the machine key being automatically generated and it changes before the user causes
the postback, and it can't validate it then.  
<br />
the fix is to set a static machine key.  
<br />
There is a <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312906">kb
article</a> with some code to generate a key for you, + instructions.   
<br /><br />
Sorted.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=07553b32-4444-49a2-a4b2-3b84b1283e21" /></body>
      <title>Fix: Unable to validate data, MachineKey.GetDecodedData</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,07553b32-4444-49a2-a4b2-3b84b1283e21.aspx</guid>
      <link>http://tim.mackey.ie/FixUnableToValidateDataMachineKeyGetDecodedData.aspx</link>
      <pubDate>Mon, 30 Jan 2006 22:53:44 GMT</pubDate>
      <description>i kept getting these sporadic error messages on my web applications and i could never figure out why.&amp;nbsp; &lt;br&gt;
&lt;pre&gt;Unable to validate data at&lt;br&gt;
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32
start, Int32 length, Int32&amp;amp; dataLength) at 
&lt;br&gt;
System.Web.UI.LosFormatter.Deserialize(String input)&lt;/pre&gt;searching the net just reveals
a troop of similarly frustrated users without solutions.&amp;nbsp; but today i found the
actual reason why, and the work-around. 
&lt;br&gt;
this excellent &lt;a href="http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21321364.html"&gt;post
on experts-exchange&lt;/a&gt; has the answer.&amp;nbsp; apparently it happens when users leave
a page open for a long time, and then cause a post back.&amp;nbsp; something to do with
the machine key being automatically generated and it changes before the user causes
the postback, and it can't validate it then.&amp;nbsp; 
&lt;br&gt;
the fix is to set a static machine key.&amp;nbsp; 
&lt;br&gt;
There is a &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q312906"&gt;kb
article&lt;/a&gt; with some code to generate a key for you, + instructions.&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
Sorted.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=07553b32-4444-49a2-a4b2-3b84b1283e21" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,07553b32-4444-49a2-a4b2-3b84b1283e21.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=b95d1f18-e472-410b-b128-c8cb0e5516ba</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,b95d1f18-e472-410b-b128-c8cb0e5516ba.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,b95d1f18-e472-410b-b128-c8cb0e5516ba.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=b95d1f18-e472-410b-b128-c8cb0e5516ba</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">a web site i'm working on imports excel
documents, and does some processing on them for importing into a database.  I
use the code from <a href="http://tim.mackey.ie/AFewUsefulFunctionsForImportingAndExportingDataInAspnetExcelPDFDatasetsDataGridsEtc.aspx">this
post</a> to do the importing, and it works nicely.  I recently came across a
problem where i was encountering duplicate records, and it took me ages to figure
out why.  Apparently a 'named range' of cells in a worksheet is treated as a
Table by ADOX.  so you get more than you bargain for when you iterate through
the tables in the resulting DataSet.  
<br />
I was able to work around the problem by discarding any tables that do NOT end in
the dollar $ character. 
<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b95d1f18-e472-410b-b128-c8cb0e5516ba" /></body>
      <title>ADOX + Excel: bogus worksheets</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,b95d1f18-e472-410b-b128-c8cb0e5516ba.aspx</guid>
      <link>http://tim.mackey.ie/ADOXExcelBogusWorksheets.aspx</link>
      <pubDate>Mon, 30 Jan 2006 15:30:12 GMT</pubDate>
      <description>a web site i'm working on imports excel documents, and does some processing on them for importing into a database.&amp;nbsp; I use the code from &lt;a href="http://tim.mackey.ie/AFewUsefulFunctionsForImportingAndExportingDataInAspnetExcelPDFDatasetsDataGridsEtc.aspx"&gt;this
post&lt;/a&gt; to do the importing, and it works nicely.&amp;nbsp; I recently came across a
problem where i was encountering duplicate records, and it took me ages to figure
out why.&amp;nbsp; Apparently a 'named range' of cells in a worksheet is treated as a
Table by ADOX.&amp;nbsp; so you get more than you bargain for when you iterate through
the tables in the resulting DataSet.&amp;nbsp; 
&lt;br&gt;
I was able to work around the problem by discarding any tables that do NOT end in
the dollar $ character. 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=b95d1f18-e472-410b-b128-c8cb0e5516ba" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,b95d1f18-e472-410b-b128-c8cb0e5516ba.aspx</comments>
      <category>.Net General</category>
      <category>Asp.Net</category>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=8a4b7e76-e10d-4063-bbab-ca339701f6a9</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,8a4b7e76-e10d-4063-bbab-ca339701f6a9.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,8a4b7e76-e10d-4063-bbab-ca339701f6a9.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=8a4b7e76-e10d-4063-bbab-ca339701f6a9</wfw:commentRss>
      <slash:comments>16</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I have a text object in my crystal report,
and i set the value programatically for it, using something like this:<br /><pre>(rpt.Section3.ReportObjects["txtDate"] as TextObject).Text = DateTime.Now.ToShortDateString();</pre>this
works fine, until you put a string with line breaks inside it, specifically \r\n or
the carriage return character.  This is a bug in CR for .Net, you can <a href="http://support.businessobjects.com/library/kbase/articles/c2015089.asp">read
the official blurb here</a>.  the work-around code they post is in VB, and it
made no sense to me when i read it. 
<br />
what they actually do is make you change the TextObject into a FormulaField (you have
to view the 'Field Explorer' tab next to the toolbox, and drag on a Formula Field). 
Then you set 'CanGrow' to true, and then you go back to your code, and do the most
arcane work-around i've ever seen.  you set the formula to your text string,
but you must surround it in single quote characters, and replace \r\n with some inline
managed code as follows: ' + chr(10) + '<br />
when i first read this, i thought they had made a syntax error, but this is the way
to do it, and it works.  the new format for setting the formula field is:<br /><pre>rpt.DataDefinition.FormulaFields[0].Text = "'" + YourString.Replace("\r\n", "' + chr(10) + '") + "'";</pre><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=8a4b7e76-e10d-4063-bbab-ca339701f6a9" /></body>
      <title>Crystal Reports TextObject ignores newline, carriage return, \r\n</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,8a4b7e76-e10d-4063-bbab-ca339701f6a9.aspx</guid>
      <link>http://tim.mackey.ie/CrystalReportsTextObjectIgnoresNewlineCarriageReturnRn.aspx</link>
      <pubDate>Wed, 25 Jan 2006 13:52:05 GMT</pubDate>
      <description>I have a text object in my crystal report, and i set the value programatically for it, using something like this:&lt;br&gt;
&lt;pre&gt;(rpt.Section3.ReportObjects["txtDate"] as TextObject).Text = DateTime.Now.ToShortDateString();&lt;/pre&gt;this
works fine, until you put a string with line breaks inside it, specifically \r\n or
the carriage return character.&amp;nbsp; This is a bug in CR for .Net, you can &lt;a href="http://support.businessobjects.com/library/kbase/articles/c2015089.asp"&gt;read
the official blurb here&lt;/a&gt;.&amp;nbsp; the work-around code they post is in VB, and it
made no sense to me when i read it. 
&lt;br&gt;
what they actually do is make you change the TextObject into a FormulaField (you have
to view the 'Field Explorer' tab next to the toolbox, and drag on a Formula Field).&amp;nbsp;
Then you set 'CanGrow' to true, and then you go back to your code, and do the most
arcane work-around i've ever seen.&amp;nbsp; you set the formula to your text string,
but you must surround it in single quote characters, and replace \r\n with some inline
managed code as follows: ' + chr(10) + '&lt;br&gt;
when i first read this, i thought they had made a syntax error, but this is the way
to do it, and it works.&amp;nbsp; the new format for setting the formula field is:&lt;br&gt;
&lt;pre&gt;rpt.DataDefinition.FormulaFields[0].Text = "'" + YourString.Replace("\r\n", "' + chr(10) + '") + "'";&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=8a4b7e76-e10d-4063-bbab-ca339701f6a9" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,8a4b7e76-e10d-4063-bbab-ca339701f6a9.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=4c03b1ad-a128-4d33-a52f-b1eda2dfaa37</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,4c03b1ad-a128-4d33-a52f-b1eda2dfaa37.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,4c03b1ad-a128-4d33-a52f-b1eda2dfaa37.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=4c03b1ad-a128-4d33-a52f-b1eda2dfaa37</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">This is the first time i have been asked
to add localization support for a content management system.  One of the supported
languages is Arabic, which is usually written right-to-left.  to achieve this,
you could obviously change your CSS or markup with something like &lt;p align="right"&gt;
but this is not the way to do it. 
<br /><br />
there is an attribute in the HTML tag that controls the direction of text (and controls)
on the page, called 'dir', which can take values 'ltr' or 'rtl', corresponding to
"left-to-right" and "right-to-left" respectively.  The advantage of setting this
property is that it instructs the browser to render all direction-related elements
of the page accordingly.  for example, in RTL mode, when you type in a text box,
the cursor stays flush to the right and the characters spread across to the left as
you type.  similarly drop-down-menu's are rendered differently, as are bullet
points, and the browser scrollbar.  these changes are shown in the screenshot
below:<br /><p></p><img src="http://tim.mackey.ie/content/binary/RTL_browser1.JPG" border="0" /><br /><br />
In this content management system, i set the direction based on the user's language
setting, stored in a cookie.  to set the DIR attribute programatically, i suggest
the following HTML tag in your Master/Template aspx page:<br /><pre>&lt;html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="htmlTag"&gt;</pre>Then
you can access it in the code behind, like so:<br /><pre>protected void Page_Load(object sender, EventArgs e)<br />
{<br />
this.htmlTag.Attributes.Add("dir", Util.HtmlDir);<br />
...<br /></pre>and then the method to determine the direction, based on the cookie. note that
'Language' in my code is an enumeration.<br /><pre>/// &lt;summary&gt;<br />
/// Returns rtl or ltr, depending on the current language setting<br />
/// &lt;/summary&gt;<br />
public static string HtmlDir<br />
{<br />
get<br />
{<br />
Language lang;<br />
try<br />
{<br />
lang = (Language)Enum.Parse(typeof(Language), HttpContext.Current.Request.Cookies["Language"].Value.ToString());<br />
}<br />
catch<br />
{<br />
// cookie not present, default to english.<br />
lang = Language.English;<br />
}<br />
switch(lang)<br />
{<br />
case Language.Arabic:<br />
return "RTL"; // right to left<br />
default:<br />
return "LTR"; // left to right<br />
}<br />
}<br />
}<br /><br />
public enum Language<br />
{<br />
English,<br />
Arabic,<br />
...<br />
}<br /></pre><p>
for more information on languages and their directions, and related browser issues, <a href="http://www.w3.org/International/questions/qa-scripts.html">see
this excellent article from W3C</a></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4c03b1ad-a128-4d33-a52f-b1eda2dfaa37" /></body>
      <title>Localization: Setting text direction for a web page</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,4c03b1ad-a128-4d33-a52f-b1eda2dfaa37.aspx</guid>
      <link>http://tim.mackey.ie/LocalizationSettingTextDirectionForAWebPage.aspx</link>
      <pubDate>Fri, 13 Jan 2006 16:28:16 GMT</pubDate>
      <description>This is the first time i have been asked to add localization support for a content management system.&amp;nbsp; One of the supported languages is Arabic, which is usually written right-to-left.&amp;nbsp; to achieve this, you could obviously change your CSS or markup with something like &amp;lt;p align="right"&amp;gt; but this is not the way to do it. &lt;br&gt;
&lt;br&gt;
there is an attribute in the HTML tag that controls the direction of text (and controls)
on the page, called 'dir', which can take values 'ltr' or 'rtl', corresponding to
"left-to-right" and "right-to-left" respectively.&amp;nbsp; The advantage of setting this
property is that it instructs the browser to render all direction-related elements
of the page accordingly.&amp;nbsp; for example, in RTL mode, when you type in a text box,
the cursor stays flush to the right and the characters spread across to the left as
you type.&amp;nbsp; similarly drop-down-menu's are rendered differently, as are bullet
points, and the browser scrollbar.&amp;nbsp; these changes are shown in the screenshot
below:&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://tim.mackey.ie/content/binary/RTL_browser1.JPG" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
In this content management system, i set the direction based on the user's language
setting, stored in a cookie.&amp;nbsp; to set the DIR attribute programatically, i suggest
the following HTML tag in your Master/Template aspx page:&lt;br&gt;
&lt;pre&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" runat="server" id="htmlTag"&amp;gt;&lt;/pre&gt;Then
you can access it in the code behind, like so:&lt;br&gt;
&lt;pre&gt;protected void Page_Load(object sender, EventArgs e)&lt;br&gt;
{&lt;br&gt;
this.htmlTag.Attributes.Add("dir", Util.HtmlDir);&lt;br&gt;
...&lt;br&gt;
&lt;/pre&gt;and then the method to determine the direction, based on the cookie. note that
'Language' in my code is an enumeration.&lt;br&gt;
&lt;pre&gt;/// &amp;lt;summary&amp;gt;&lt;br&gt;
/// Returns rtl or ltr, depending on the current language setting&lt;br&gt;
/// &amp;lt;/summary&amp;gt;&lt;br&gt;
public static string HtmlDir&lt;br&gt;
{&lt;br&gt;
get&lt;br&gt;
{&lt;br&gt;
Language lang;&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
lang = (Language)Enum.Parse(typeof(Language), HttpContext.Current.Request.Cookies["Language"].Value.ToString());&lt;br&gt;
}&lt;br&gt;
catch&lt;br&gt;
{&lt;br&gt;
// cookie not present, default to english.&lt;br&gt;
lang = Language.English;&lt;br&gt;
}&lt;br&gt;
switch(lang)&lt;br&gt;
{&lt;br&gt;
case Language.Arabic:&lt;br&gt;
return "RTL"; // right to left&lt;br&gt;
default:&lt;br&gt;
return "LTR"; // left to right&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
public enum Language&lt;br&gt;
{&lt;br&gt;
English,&lt;br&gt;
Arabic,&lt;br&gt;
...&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
for more information on languages and their directions, and related browser issues, &lt;a href="http://www.w3.org/International/questions/qa-scripts.html"&gt;see
this excellent article from W3C&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4c03b1ad-a128-4d33-a52f-b1eda2dfaa37" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,4c03b1ad-a128-4d33-a52f-b1eda2dfaa37.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=4fa89783-a4cb-41c2-8b23-1d8c50ee5b26</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,4fa89783-a4cb-41c2-8b23-1d8c50ee5b26.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,4fa89783-a4cb-41c2-8b23-1d8c50ee5b26.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=4fa89783-a4cb-41c2-8b23-1d8c50ee5b26</wfw:commentRss>
      <slash:comments>64</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">for some bizarre reason, you have to set
HtmlEncode=false on a bound column in a gridview, to get the DataFormatString to work. 
<br />
i hope this helps somebody else staring at their gridview in disbelief as to why it
doesn't work by default!<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4fa89783-a4cb-41c2-8b23-1d8c50ee5b26" /></body>
      <title>Fix: GridView DataFormatString not applied</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,4fa89783-a4cb-41c2-8b23-1d8c50ee5b26.aspx</guid>
      <link>http://tim.mackey.ie/FixGridViewDataFormatStringNotApplied.aspx</link>
      <pubDate>Thu, 12 Jan 2006 16:01:38 GMT</pubDate>
      <description>for some bizarre reason, you have to set HtmlEncode=false on a bound column in a gridview, to get the DataFormatString to work. &lt;br&gt;
i hope this helps somebody else staring at their gridview in disbelief as to why it
doesn't work by default!&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4fa89783-a4cb-41c2-8b23-1d8c50ee5b26" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,4fa89783-a4cb-41c2-8b23-1d8c50ee5b26.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=4796b7f6-d1c8-4f4d-a472-03a482b0de15</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,4796b7f6-d1c8-4f4d-a472-03a482b0de15.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,4796b7f6-d1c8-4f4d-a472-03a482b0de15.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=4796b7f6-d1c8-4f4d-a472-03a482b0de15</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I ran into a frustrating problem today
where some properties of my objects weren't getting serialized.  I noticed it
was the ones without 'set' accessors.  I didn't want to put set accessors in
because the properties should be read-only, but apparently the xml serializer needs
the set accessor to de-serialize.  
<br />
there is a good discussion on it on <a href="http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/36456d10b2bf53df/">this
thread.</a><br />
Luckily we can use the ReadOnlyAttribute setting on the property to prevent it being
modified by a programmer at design time.<br />
or you can use the Soap serializer instead of xml, whatever that is.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4796b7f6-d1c8-4f4d-a472-03a482b0de15" /></body>
      <title>Xml Serialization: Properties left out without 'set' accessor</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,4796b7f6-d1c8-4f4d-a472-03a482b0de15.aspx</guid>
      <link>http://tim.mackey.ie/XmlSerializationPropertiesLeftOutWithoutSetAccessor.aspx</link>
      <pubDate>Mon, 09 Jan 2006 17:57:34 GMT</pubDate>
      <description>I ran into a frustrating problem today where some properties of my objects weren't getting serialized.&amp;nbsp; I noticed it was the ones without 'set' accessors.&amp;nbsp; I didn't want to put set accessors in because the properties should be read-only, but apparently the xml serializer needs the set accessor to de-serialize.&amp;nbsp; &lt;br&gt;
there is a good discussion on it on &lt;a href="http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/36456d10b2bf53df/"&gt;this
thread.&lt;/a&gt;
&lt;br&gt;
Luckily we can use the ReadOnlyAttribute setting on the property to prevent it being
modified by a programmer at design time.&lt;br&gt;
or you can use the Soap serializer instead of xml, whatever that is.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=4796b7f6-d1c8-4f4d-a472-03a482b0de15" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,4796b7f6-d1c8-4f4d-a472-03a482b0de15.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=9603c0e9-a99e-4d6e-bfef-d4abb7ae9501</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,9603c0e9-a99e-4d6e-bfef-d4abb7ae9501.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,9603c0e9-a99e-4d6e-bfef-d4abb7ae9501.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=9603c0e9-a99e-4d6e-bfef-d4abb7ae9501</wfw:commentRss>
      <slash:comments>24</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">just posting my code-project <a href="http://www.codeproject.com/soap/MTOMWebServices.asp">article
on http chunking web services with MTOM</a> here for reference.  by the way it
has been updated on codeproject...<br /><br /><ul class="download"><li><a href="http://www.codeproject.com/soap/MTOMWebServices/Article_source.zip">Download
source for web service + Windows client - 52.1 Kb</a></li></ul><p><img alt="Screenshot of windows forms client, uploading a file" src="http://www.codeproject.com/soap/MTOMWebServices/Article.jpg" /></p><h2>Introduction
</h2><p>
In trying to keep up to speed with .NET 2.0, I decided to do a .NET 2.0 version of
my CodeProject article <a href="http://www.codeproject.com/cs/webservices/DimeBufferedUpload.asp">"DIME
Buffered Upload"</a> which used the DIME standard to transfer binary data over web
services. The DIME approach was reasonably efficient but the code is quite complex
and I was keen to explore what .NET 2.0 has to offer. In this article, I use version
3.0 of the WSE (<a href="http://msdn.microsoft.com/webservices/webservices/building/wse/" target="_blank">Web
Service Enhancements</a>) which is available for .NET 2.0 as an add-in, to provide
a simpler and faster method of sending binary data in small chunks over HTTP web services.
</p><h2>Background
</h2><p>
Just a recap on why you may need to send data in small chunks at all: if you have
a large file and you want to send it across a web service, you must understand the
way it all fits together between IIS, .NET, and the web service call. You send your
file as an array of bytes, as a parameter to a web service call, which is all sent
to the IIS web server as a single request. This is bad if the size of the file is
beyond the configured <code>MaxRequestLength</code> of your application, or if the
request causes an IIS timeout. It is also bad from the point of view of providing
feedback of the file transfer to the user interface because you have no indication
how the transfer is going, until it is either completed or failed. The solution outlined
here is to send chunks of the file one by one, and append them to the file on the
server.
</p><p>
There is an MD5 file hash done on the client and the server to verify that the file
received is identical to the file sent.
</p><p>
Also, there is an upload and download code included in this article.
</p><h2>Adventures with MTOM
</h2><p>
MTOM stands for SOAP "Message Transmission Optimization Mechanism" and it is a <a href="http://www.w3.org/TR/2005/REC-soap12-mtom-20050125/" target="_blank">W3C
standard</a>. To use it (and to run this application), you must download and install <a href="http://msdn.microsoft.com/webservices/webservices/building/wse/" target="_blank">WSE
3.0</a>, which includes MTOM support for the first time. If you look in the <i>app.config</i> and <i>web.config</i> files
in the source code, you will see sections referring to the WSE 3 assembly, and a messaging <code>clientMode</code> or <code>serverMode</code> setting.
These are necessary to run MTOM in the application.
</p><p>
The problem with DIME was that the binary content of the message was sent outside
the <code>SoapEnvelope</code> of the XML message. This meant that although your message
was secure, the Dime Attachment may not be secure. MTOM fully complies with the other
WS-* specifications (like WS-Security) so the entire message is secure.
</p><p>
It took me a while to realise that when MTOM is turned on for the client and the server,
WSE automatically handles the binary encoding of the data in the web service message.
With DIME and WSE 2.0, you had to configure your app for DIME and then use DimeAttachments
in your code. This is no longer necessary, you just send your byte[] as a parameter
or return value, and WSE makes sure that it is sent as binary, and not padded by XML
serialization as it would be in the absence of DIME or MTOM.
</p><h2>How it works
</h2><p>
The web service has two main methods, <code>AppendChunk</code> is for uploading a
file to the server, <code>DownloadChunk</code> is for downloading from the server.
These methods receive parameters for the file name, the offset of the chunk, and the
size of the buffer being sent/received.
</p><p>
The Windows Forms client application can upload a file by sending all the chunks one
after the other using <code>AppendChunk</code>, until the file has been completely
sent. It can do an MD5 hash on the local file, and compare it with the hash on the
file on the server, to make sure the contents of the files are identical. The download
code is very similar, the main difference is that the client must know from the server
how big the file is, so that it can know when to stop requesting chunks.
</p><p>
A simplified version of the <b>upload code is shown below</b> (from the WinForms client).
Have a look in the code for <i>Form1.cs</i> to see the inline comments + the explanation
of the code. Essentially, a file stream is opened on the client for the duration of
the transfer. Then the first chunk is read into the <code>Buffer</code> byte array.
The <code lang="cs"><span class="cs-keyword">while</span></code> loop keeps running
until the <code>FileStream.Read()</code> method returns 0, i.e. the end of the file
has been reached. For each iteration, the buffer is sent directly to the web service
as a <code lang="cs"><span class="cs-keyword">byte</span>[]</code>. The '<code>SentBytes</code>'
variable is used to report progress to the form.
</p><pre>using(FileStream fs = new FileStream(LocalFilePath, FileMode.Open, FileAccess.Read))<br />
{<br />
int BytesRead = fs.Read(Buffer, 0, ChunkSize);<br />
while(BytesRead &gt; 0 &amp;&amp; !worker.CancellationPending)<br />
{<br />
ws.AppendChunk(FileName, Buffer, SentBytes, BytesRead);<br />
SentBytes += BytesRead;<br />
BytesRead = fs.Read(Buffer, 0, ChunkSize); 
<br />
}<br />
}</pre><h2>Example of the BackgroundWorker class in .NET 2.0
</h2><p>
.NET 2.0 has a great new class called '<code>BackgroundWorker</code>' to simplify
running tasks asynchronously. Although this application sends the file in small chunks,
even these small chunks would delay the WinForms application and make it look crashed
during the transfer. So the web service calls still need to be done asynchronously.
The <code>BackgroundWorker</code> class works using an event model, where you have
code sections to run for <code>DoWork</code> (when you start), <code>ProgressChanged</code> (to
update your progress bar / status bar), and <code>Completed</code> (or failed). You
can pass parameters to the <code>DoWork</code> method, which you could not do with
the <code>Thread</code> class in .NET 1.1 (I know you could with delegates, but delegates
aren't great for thread control). You can also access the return value of <code>DoWork</code> in
the <code>Completed</code> event handler. So for once, MS has thought of everything
and made a very clean threading model. Exceptions are handled internally and you can
access them in the <code>Completed</code> method via the <code>RunWorkerCompletedEventArgs.Error</code> property.
</p><p>
The code shown below is an example of the <code>ProgressChanged</code> event handler:
</p><pre>private void workerUpload_ProgressChanged(object sender, ProgressChangedEventArgs e)<br />
{<br />
// update the progress bar and status bar text<br />
this.toolStripProgressBar1.Value = e.ProgressPercentage;<br />
this.statusText.Text = e.UserState.ToString();<br />
// summary text is sent in the UserState parameter<br />
}<br /></pre><p>
I have used four <code>BackgroundWorker</code> objects in the application:
</p><ul><li>
one to manage the upload process, 
</li><li>
one to manage the download process, 
</li><li>
another to calculate the local MD5 file hash in parallel while waiting for the server
result, 
</li><li>
and another to download the list of files in the <i>Upload</i> server folder to allow
the user to select a file to download. 
</li></ul><p>
The reason I use a <code>BackgroundWorker</code> object for each task is because the
code for each task is tied in to the events for that object.
</p><h2>A good example of Thread.Join()
</h2><p>
When the upload or download is complete, the client asks for an MD5 hash of the file
on the server, so it can compare it with the local file to make sure they are identical.
I originally did these in sequence. But it can take a few seconds to calculate the
result for a large file (anything over a few hundred MB), so the application was waiting
five seconds for the server to calculate the hash, and then five more seconds for
the client to calculate its own hash. This made no sense, so I decided to implement
a multi-threaded approach to allow them to run in parallel. While the client is waiting
on the server, it should be calculating its own file hash. This is done with the <code>Thread</code> class,
and the use of the <code>Join()</code> method which blocks execution until the thread
is complete.
</p><p>
The code below shows how this is accomplished:
</p><pre>// start calculating the local hash (stored in class variable)<br />
this.hashThread = new Thread(new ThreadStart(this.CheckFileHash));<br />
this.hashThread.Start();<br /><br />
// request the server hash<br />
string ServerFileHash = ws.CheckFileHash(FileName);<br /><br />
// wait for the local hash to complete<br />
this.hashThread.Join();<br /><br />
if(this.LocalFileHash == ServerFileHash)<br />
e.Result = "Hashes match exactly";<br />
else 
<br />
e.Result = "Hashes do not match";<br /></pre><p>
There is a good chance that the two operations will finish at approximately the same
time, so very little waiting around will actually happen.
</p><h2>Performance compared with DIME
</h2><p>
I found that MTOM was about 10% faster than DIME in my limited testing. This is probably
to do with the need to package up each chunk into a DIME attachment, which is no longer
necessary with MTOM. I was able to upload files of several gigabytes in size without
problems.
</p><p>
Obviously, there is an overhead with all this business of reading file chunks and
appending them, so the larger the chunk size, the more efficient your application
will be. It should be customised based on the network and the expected size of files.
For very small files, it is no harm to use small chunk sizes (e.g., 32 Kb) because
this will give accurate and regular feedback to the user interface. For very large
files on a fast network, consider using 4000 Kb to make good use of the bandwidth
and reduce the File Input/Output overhead. If you want to send chunks larger than
4 MB, you must increase the .NET 2.0 Max Request Size limit in your <i>web.config</i>.
</p><h2>Conclusions
</h2><p>
Feel free to use this code and modify it as you please. Please post a comment for
any bugs, suggestions, or improvements. Enjoy!
</p><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=9603c0e9-a99e-4d6e-bfef-d4abb7ae9501" /></body>
      <title>Sending files in chunks with MTOM Web Services and .NET 2.0</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,9603c0e9-a99e-4d6e-bfef-d4abb7ae9501.aspx</guid>
      <link>http://tim.mackey.ie/SendingFilesInChunksWithMTOMWebServicesAndNET20.aspx</link>
      <pubDate>Thu, 29 Dec 2005 20:34:15 GMT</pubDate>
      <description>just posting my code-project &lt;a href="http://www.codeproject.com/soap/MTOMWebServices.asp"&gt;article
on http chunking web services with MTOM&lt;/a&gt; here for reference.&amp;nbsp; by the way it
has been updated on codeproject...&lt;br&gt;
&lt;br&gt;
&lt;ul class="download"&gt;
&lt;li&gt;
&lt;a href="http://www.codeproject.com/soap/MTOMWebServices/Article_source.zip"&gt;Download
source for web service + Windows client - 52.1 Kb&lt;/a&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;img alt="Screenshot of windows forms client, uploading a file" src="http://www.codeproject.com/soap/MTOMWebServices/Article.jpg"&gt;
&lt;/p&gt;
&lt;h2&gt;Introduction
&lt;/h2&gt;
&lt;p&gt;
In trying to keep up to speed with .NET 2.0, I decided to do a .NET 2.0 version of
my CodeProject article &lt;a href="http://www.codeproject.com/cs/webservices/DimeBufferedUpload.asp"&gt;"DIME
Buffered Upload"&lt;/a&gt; which used the DIME standard to transfer binary data over web
services. The DIME approach was reasonably efficient but the code is quite complex
and I was keen to explore what .NET 2.0 has to offer. In this article, I use version
3.0 of the WSE (&lt;a href="http://msdn.microsoft.com/webservices/webservices/building/wse/" target="_blank"&gt;Web
Service Enhancements&lt;/a&gt;) which is available for .NET 2.0 as an add-in, to provide
a simpler and faster method of sending binary data in small chunks over HTTP web services.
&lt;/p&gt;
&lt;h2&gt;Background
&lt;/h2&gt;
&lt;p&gt;
Just a recap on why you may need to send data in small chunks at all: if you have
a large file and you want to send it across a web service, you must understand the
way it all fits together between IIS, .NET, and the web service call. You send your
file as an array of bytes, as a parameter to a web service call, which is all sent
to the IIS web server as a single request. This is bad if the size of the file is
beyond the configured &lt;code&gt;MaxRequestLength&lt;/code&gt; of your application, or if the
request causes an IIS timeout. It is also bad from the point of view of providing
feedback of the file transfer to the user interface because you have no indication
how the transfer is going, until it is either completed or failed. The solution outlined
here is to send chunks of the file one by one, and append them to the file on the
server.
&lt;/p&gt;
&lt;p&gt;
There is an MD5 file hash done on the client and the server to verify that the file
received is identical to the file sent.
&lt;/p&gt;
&lt;p&gt;
Also, there is an upload and download code included in this article.
&lt;/p&gt;
&lt;h2&gt;Adventures with MTOM
&lt;/h2&gt;
&lt;p&gt;
MTOM stands for SOAP "Message Transmission Optimization Mechanism" and it is a &lt;a href="http://www.w3.org/TR/2005/REC-soap12-mtom-20050125/" target="_blank"&gt;W3C
standard&lt;/a&gt;. To use it (and to run this application), you must download and install &lt;a href="http://msdn.microsoft.com/webservices/webservices/building/wse/" target="_blank"&gt;WSE
3.0&lt;/a&gt;, which includes MTOM support for the first time. If you look in the &lt;i&gt;app.config&lt;/i&gt; and &lt;i&gt;web.config&lt;/i&gt; files
in the source code, you will see sections referring to the WSE 3 assembly, and a messaging &lt;code&gt;clientMode&lt;/code&gt; or &lt;code&gt;serverMode&lt;/code&gt; setting.
These are necessary to run MTOM in the application.
&lt;/p&gt;
&lt;p&gt;
The problem with DIME was that the binary content of the message was sent outside
the &lt;code&gt;SoapEnvelope&lt;/code&gt; of the XML message. This meant that although your message
was secure, the Dime Attachment may not be secure. MTOM fully complies with the other
WS-* specifications (like WS-Security) so the entire message is secure.
&lt;/p&gt;
&lt;p&gt;
It took me a while to realise that when MTOM is turned on for the client and the server,
WSE automatically handles the binary encoding of the data in the web service message.
With DIME and WSE 2.0, you had to configure your app for DIME and then use DimeAttachments
in your code. This is no longer necessary, you just send your byte[] as a parameter
or return value, and WSE makes sure that it is sent as binary, and not padded by XML
serialization as it would be in the absence of DIME or MTOM.
&lt;/p&gt;
&lt;h2&gt;How it works
&lt;/h2&gt;
&lt;p&gt;
The web service has two main methods, &lt;code&gt;AppendChunk&lt;/code&gt; is for uploading a
file to the server, &lt;code&gt;DownloadChunk&lt;/code&gt; is for downloading from the server.
These methods receive parameters for the file name, the offset of the chunk, and the
size of the buffer being sent/received.
&lt;/p&gt;
&lt;p&gt;
The Windows Forms client application can upload a file by sending all the chunks one
after the other using &lt;code&gt;AppendChunk&lt;/code&gt;, until the file has been completely
sent. It can do an MD5 hash on the local file, and compare it with the hash on the
file on the server, to make sure the contents of the files are identical. The download
code is very similar, the main difference is that the client must know from the server
how big the file is, so that it can know when to stop requesting chunks.
&lt;/p&gt;
&lt;p&gt;
A simplified version of the &lt;b&gt;upload code is shown below&lt;/b&gt; (from the WinForms client).
Have a look in the code for &lt;i&gt;Form1.cs&lt;/i&gt; to see the inline comments + the explanation
of the code. Essentially, a file stream is opened on the client for the duration of
the transfer. Then the first chunk is read into the &lt;code&gt;Buffer&lt;/code&gt; byte array.
The &lt;code lang="cs"&gt;&lt;span class="cs-keyword"&gt;while&lt;/span&gt;&lt;/code&gt; loop keeps running
until the &lt;code&gt;FileStream.Read()&lt;/code&gt; method returns 0, i.e. the end of the file
has been reached. For each iteration, the buffer is sent directly to the web service
as a &lt;code lang="cs"&gt;&lt;span class="cs-keyword"&gt;byte&lt;/span&gt;[]&lt;/code&gt;. The '&lt;code&gt;SentBytes&lt;/code&gt;'
variable is used to report progress to the form.
&lt;/p&gt;
&lt;pre&gt;using(FileStream fs = new FileStream(LocalFilePath, FileMode.Open, FileAccess.Read))&lt;br&gt;
{&lt;br&gt;
int BytesRead = fs.Read(Buffer, 0, ChunkSize);&lt;br&gt;
while(BytesRead &amp;gt; 0 &amp;amp;&amp;amp; !worker.CancellationPending)&lt;br&gt;
{&lt;br&gt;
ws.AppendChunk(FileName, Buffer, SentBytes, BytesRead);&lt;br&gt;
SentBytes += BytesRead;&lt;br&gt;
BytesRead = fs.Read(Buffer, 0, ChunkSize); 
&lt;br&gt;
}&lt;br&gt;
}&lt;/pre&gt;
&lt;h2&gt;Example of the BackgroundWorker class in .NET 2.0
&lt;/h2&gt;
&lt;p&gt;
.NET 2.0 has a great new class called '&lt;code&gt;BackgroundWorker&lt;/code&gt;' to simplify
running tasks asynchronously. Although this application sends the file in small chunks,
even these small chunks would delay the WinForms application and make it look crashed
during the transfer. So the web service calls still need to be done asynchronously.
The &lt;code&gt;BackgroundWorker&lt;/code&gt; class works using an event model, where you have
code sections to run for &lt;code&gt;DoWork&lt;/code&gt; (when you start), &lt;code&gt;ProgressChanged&lt;/code&gt; (to
update your progress bar / status bar), and &lt;code&gt;Completed&lt;/code&gt; (or failed). You
can pass parameters to the &lt;code&gt;DoWork&lt;/code&gt; method, which you could not do with
the &lt;code&gt;Thread&lt;/code&gt; class in .NET 1.1 (I know you could with delegates, but delegates
aren't great for thread control). You can also access the return value of &lt;code&gt;DoWork&lt;/code&gt; in
the &lt;code&gt;Completed&lt;/code&gt; event handler. So for once, MS has thought of everything
and made a very clean threading model. Exceptions are handled internally and you can
access them in the &lt;code&gt;Completed&lt;/code&gt; method via the &lt;code&gt;RunWorkerCompletedEventArgs.Error&lt;/code&gt; property.
&lt;/p&gt;
&lt;p&gt;
The code shown below is an example of the &lt;code&gt;ProgressChanged&lt;/code&gt; event handler:
&lt;/p&gt;
&lt;pre&gt;private void workerUpload_ProgressChanged(object sender, ProgressChangedEventArgs e)&lt;br&gt;
{&lt;br&gt;
// update the progress bar and status bar text&lt;br&gt;
this.toolStripProgressBar1.Value = e.ProgressPercentage;&lt;br&gt;
this.statusText.Text = e.UserState.ToString();&lt;br&gt;
// summary text is sent in the UserState parameter&lt;br&gt;
}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
I have used four &lt;code&gt;BackgroundWorker&lt;/code&gt; objects in the application:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
one to manage the upload process, 
&lt;/li&gt;
&lt;li&gt;
one to manage the download process, 
&lt;/li&gt;
&lt;li&gt;
another to calculate the local MD5 file hash in parallel while waiting for the server
result, 
&lt;/li&gt;
&lt;li&gt;
and another to download the list of files in the &lt;i&gt;Upload&lt;/i&gt; server folder to allow
the user to select a file to download. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The reason I use a &lt;code&gt;BackgroundWorker&lt;/code&gt; object for each task is because the
code for each task is tied in to the events for that object.
&lt;/p&gt;
&lt;h2&gt;A good example of Thread.Join()
&lt;/h2&gt;
&lt;p&gt;
When the upload or download is complete, the client asks for an MD5 hash of the file
on the server, so it can compare it with the local file to make sure they are identical.
I originally did these in sequence. But it can take a few seconds to calculate the
result for a large file (anything over a few hundred MB), so the application was waiting
five seconds for the server to calculate the hash, and then five more seconds for
the client to calculate its own hash. This made no sense, so I decided to implement
a multi-threaded approach to allow them to run in parallel. While the client is waiting
on the server, it should be calculating its own file hash. This is done with the &lt;code&gt;Thread&lt;/code&gt; class,
and the use of the &lt;code&gt;Join()&lt;/code&gt; method which blocks execution until the thread
is complete.
&lt;/p&gt;
&lt;p&gt;
The code below shows how this is accomplished:
&lt;/p&gt;
&lt;pre&gt;// start calculating the local hash (stored in class variable)&lt;br&gt;
this.hashThread = new Thread(new ThreadStart(this.CheckFileHash));&lt;br&gt;
this.hashThread.Start();&lt;br&gt;
&lt;br&gt;
// request the server hash&lt;br&gt;
string ServerFileHash = ws.CheckFileHash(FileName);&lt;br&gt;
&lt;br&gt;
// wait for the local hash to complete&lt;br&gt;
this.hashThread.Join();&lt;br&gt;
&lt;br&gt;
if(this.LocalFileHash == ServerFileHash)&lt;br&gt;
e.Result = "Hashes match exactly";&lt;br&gt;
else 
&lt;br&gt;
e.Result = "Hashes do not match";&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
There is a good chance that the two operations will finish at approximately the same
time, so very little waiting around will actually happen.
&lt;/p&gt;
&lt;h2&gt;Performance compared with DIME
&lt;/h2&gt;
&lt;p&gt;
I found that MTOM was about 10% faster than DIME in my limited testing. This is probably
to do with the need to package up each chunk into a DIME attachment, which is no longer
necessary with MTOM. I was able to upload files of several gigabytes in size without
problems.
&lt;/p&gt;
&lt;p&gt;
Obviously, there is an overhead with all this business of reading file chunks and
appending them, so the larger the chunk size, the more efficient your application
will be. It should be customised based on the network and the expected size of files.
For very small files, it is no harm to use small chunk sizes (e.g., 32 Kb) because
this will give accurate and regular feedback to the user interface. For very large
files on a fast network, consider using 4000 Kb to make good use of the bandwidth
and reduce the File Input/Output overhead. If you want to send chunks larger than
4 MB, you must increase the .NET 2.0 Max Request Size limit in your &lt;i&gt;web.config&lt;/i&gt;.
&lt;/p&gt;
&lt;h2&gt;Conclusions
&lt;/h2&gt;
&lt;p&gt;
Feel free to use this code and modify it as you please. Please post a comment for
any bugs, suggestions, or improvements. Enjoy!
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=9603c0e9-a99e-4d6e-bfef-d4abb7ae9501" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,9603c0e9-a99e-4d6e-bfef-d4abb7ae9501.aspx</comments>
      <category>.Net General</category>
      <category>.Net Windows Forms</category>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=3975f129-f165-486a-a5a5-b84446435723</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,3975f129-f165-486a-a5a5-b84446435723.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,3975f129-f165-486a-a5a5-b84446435723.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=3975f129-f165-486a-a5a5-b84446435723</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm new to <a href="http://www.w3.org/TR/2005/REC-soap12-mtom-20050125/">MTOM</a>,
and i encountered this error while developing a <a href="http://msdn.microsoft.com/webservices/webservices/building/wse/">WSE
3.0</a> application with .net. 
<br /><pre>The request failed with HTTP status 415: Unsupported media type</pre><h2>Explanation 1 - Basic Configuration Error<br /></h2><p>
After a lot of digging around and comparing my code with the MTOM sample bundled with
WSE3, i found out it was because i was missing a setting called "<i><b>soapServerProtocolFactory</b></i>"
in my web.config, shown below.  I didn't think i needed to have a Protocol Factory
(whatever that is!), but apparently I do. It works fine now that i added that section.<br /></p>
This is what my web.config looks like:<br /><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;configuration&gt;<br />
&lt;configSections&gt;<br />
&lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;/configSections&gt;<br />
&lt;appSettings&gt;<br />
&lt;add key="UploadPath" value="Upload" /&gt;<br />
&lt;/appSettings&gt;<br />
&lt;system.web&gt;<br />
&lt;webServices&gt;<br />
&lt;soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;<br />
&lt;soapExtensionImporterTypes&gt;<br />
&lt;add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;<br />
&lt;/soapExtensionImporterTypes&gt;<br />
&lt;/webServices&gt;<br />
&lt;compilation&gt;<br />
&lt;assemblies&gt;<br />
&lt;add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/&gt;<br />
&lt;/assemblies&gt;<br />
&lt;/compilation&gt;<br />
&lt;/system.web&gt;<br />
&lt;microsoft.web.services3&gt;<br />
&lt;messaging&gt;<br />
&lt;mtom serverMode="optional" /&gt;<br />
&lt;/messaging&gt;<br />
&lt;/microsoft.web.services3&gt;<br />
&lt;/configuration&gt;<br /></pre>My app.config for the Windows Client looks like this:<br /><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;configuration&gt;<br />
&lt;configSections&gt;<br />
&lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&gt;<br />
&lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;<br />
&lt;section name="UploadWinClient.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/&gt;<br />
&lt;/sectionGroup&gt;<br />
&lt;/configSections&gt;<br />
&lt;microsoft.web.services3&gt;<br />
&lt;messaging&gt;<br />
&lt;mtom clientMode="On" /&gt;<br />
&lt;/messaging&gt;<br />
&lt;/microsoft.web.services3&gt;<br />
&lt;applicationSettings&gt;<br />
&lt;UploadWinClient.Properties.Settings&gt;<br />
&lt;setting name="UploadWinClient_MTOM_WebService_MTOM" serializeAs="String"&gt;<br />
&lt;value&gt;http://localhost:1423/UploadWebClient/MTOM.asmx&lt;/value&gt;<br />
&lt;/setting&gt;<br />
&lt;/UploadWinClient.Properties.Settings&gt;<br />
&lt;/applicationSettings&gt;<br />
&lt;/configuration&gt;<br /></pre><h2>Explanation 2 - Strange Behaviour with Web Service instances...
</h2>
if you're configuration is already correct, then the following may be of interest. 
i came across this error in a winforms application, that has a class library with
an MTOM web service in it.  my code had something like this:<br /><pre>myClassLibrary.WebService = this.WebService;</pre>i was doing this because i
had an instance of the web service in the win form, authenticated with a cookie in
its CookieContainer property, and i wanted to replace the web service that the class
library was using with the one from my win-form.  however this caused the 415
error to appear sporadically all over the place.  the fix was to just replace
the CookieContainer instead of the entire web service instance.  like so:<br /><pre>myClassLibrary.WebService.CookieContainer = this.WebService.CookieContainer;<br /></pre><p></p>
now i get no errors.  weird huh?<br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=3975f129-f165-486a-a5a5-b84446435723" /></body>
      <title>MTOM error: The request failed with HTTP status 415: Unsupported media type</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,3975f129-f165-486a-a5a5-b84446435723.aspx</guid>
      <link>http://tim.mackey.ie/MTOMErrorTheRequestFailedWithHTTPStatus415UnsupportedMediaType.aspx</link>
      <pubDate>Thu, 22 Dec 2005 16:13:34 GMT</pubDate>
      <description>I'm new to &lt;a href="http://www.w3.org/TR/2005/REC-soap12-mtom-20050125/"&gt;MTOM&lt;/a&gt;,
and i encountered this error while developing a &lt;a href="http://msdn.microsoft.com/webservices/webservices/building/wse/"&gt;WSE
3.0&lt;/a&gt; application with .net. 
&lt;br&gt;
&lt;pre&gt;The request failed with HTTP status 415: Unsupported media type&lt;/pre&gt;
&lt;h2&gt;Explanation 1 - Basic Configuration Error&lt;br&gt;
&lt;/h2&gt;
&lt;p&gt;
After a lot of digging around and comparing my code with the MTOM sample bundled with
WSE3, i found out it was because i was missing a setting called "&lt;i&gt;&lt;b&gt;soapServerProtocolFactory&lt;/b&gt;&lt;/i&gt;"
in my web.config, shown below.&amp;nbsp; I didn't think i needed to have a Protocol Factory
(whatever that is!), but apparently I do. It works fine now that i added that section.&lt;br&gt;
&lt;/p&gt;
This is what my web.config looks like:&lt;br&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br&gt;
&amp;lt;configuration&amp;gt;&lt;br&gt;
&amp;lt;configSections&amp;gt;&lt;br&gt;
&amp;lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;/configSections&amp;gt;&lt;br&gt;
&amp;lt;appSettings&amp;gt;&lt;br&gt;
&amp;lt;add key="UploadPath" value="Upload" /&amp;gt;&lt;br&gt;
&amp;lt;/appSettings&amp;gt;&lt;br&gt;
&amp;lt;system.web&amp;gt;&lt;br&gt;
&amp;lt;webServices&amp;gt;&lt;br&gt;
&amp;lt;soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;br&gt;
&amp;lt;soapExtensionImporterTypes&amp;gt;&lt;br&gt;
&amp;lt;add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;br&gt;
&amp;lt;/soapExtensionImporterTypes&amp;gt;&lt;br&gt;
&amp;lt;/webServices&amp;gt;&lt;br&gt;
&amp;lt;compilation&amp;gt;&lt;br&gt;
&amp;lt;assemblies&amp;gt;&lt;br&gt;
&amp;lt;add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/&amp;gt;&lt;br&gt;
&amp;lt;/assemblies&amp;gt;&lt;br&gt;
&amp;lt;/compilation&amp;gt;&lt;br&gt;
&amp;lt;/system.web&amp;gt;&lt;br&gt;
&amp;lt;microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;messaging&amp;gt;&lt;br&gt;
&amp;lt;mtom serverMode="optional" /&amp;gt;&lt;br&gt;
&amp;lt;/messaging&amp;gt;&lt;br&gt;
&amp;lt;/microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;/configuration&amp;gt;&lt;br&gt;
&lt;/pre&gt;My app.config for the Windows Client looks like this:&lt;br&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br&gt;
&amp;lt;configuration&amp;gt;&lt;br&gt;
&amp;lt;configSections&amp;gt;&lt;br&gt;
&amp;lt;section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
/&amp;gt;&lt;br&gt;
&amp;lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&amp;gt;&lt;br&gt;
&amp;lt;section name="UploadWinClient.Properties.Settings" type="System.Configuration.ClientSettingsSection,
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"
/&amp;gt;&lt;br&gt;
&amp;lt;/sectionGroup&amp;gt;&lt;br&gt;
&amp;lt;/configSections&amp;gt;&lt;br&gt;
&amp;lt;microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;messaging&amp;gt;&lt;br&gt;
&amp;lt;mtom clientMode="On" /&amp;gt;&lt;br&gt;
&amp;lt;/messaging&amp;gt;&lt;br&gt;
&amp;lt;/microsoft.web.services3&amp;gt;&lt;br&gt;
&amp;lt;applicationSettings&amp;gt;&lt;br&gt;
&amp;lt;UploadWinClient.Properties.Settings&amp;gt;&lt;br&gt;
&amp;lt;setting name="UploadWinClient_MTOM_WebService_MTOM" serializeAs="String"&amp;gt;&lt;br&gt;
&amp;lt;value&amp;gt;http://localhost:1423/UploadWebClient/MTOM.asmx&amp;lt;/value&amp;gt;&lt;br&gt;
&amp;lt;/setting&amp;gt;&lt;br&gt;
&amp;lt;/UploadWinClient.Properties.Settings&amp;gt;&lt;br&gt;
&amp;lt;/applicationSettings&amp;gt;&lt;br&gt;
&amp;lt;/configuration&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;h2&gt;Explanation 2 - Strange Behaviour with Web Service instances...
&lt;/h2&gt;
if you're configuration is already correct, then the following may be of interest.&amp;nbsp;
i came across this error in a winforms application, that has a class library with
an MTOM web service in it.&amp;nbsp; my code had something like this:&lt;br&gt;
&lt;pre&gt;myClassLibrary.WebService = this.WebService;&lt;/pre&gt;i was doing this because i
had an instance of the web service in the win form, authenticated with a cookie in
its CookieContainer property, and i wanted to replace the web service that the class
library was using with the one from my win-form.&amp;nbsp; however this caused the 415
error to appear sporadically all over the place.&amp;nbsp; the fix was to just replace
the CookieContainer instead of the entire web service instance.&amp;nbsp; like so:&lt;br&gt;
&lt;pre&gt;myClassLibrary.WebService.CookieContainer = this.WebService.CookieContainer;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
now i get no errors.&amp;nbsp; weird huh?&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=3975f129-f165-486a-a5a5-b84446435723" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,3975f129-f165-486a-a5a5-b84446435723.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=d4649bc5-6875-4011-966c-e3a480f558f4</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,d4649bc5-6875-4011-966c-e3a480f558f4.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,d4649bc5-6875-4011-966c-e3a480f558f4.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=d4649bc5-6875-4011-966c-e3a480f558f4</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>A field or property with the name 'xyz' was not found on the selected data source
</h3>
I get this error when i bind a GridView to an array of custom objects with public
variables.  
<br />
The recommended pattern for designing classes is to have private variables with public
properties with get/set etc, but for my current application i'm not bothering with
that. Apparently because of the Reflection methods used in GridView databinding, you
have to have properties to bind fields in the GridView to your object fields.  
<br /><br />
bit of a pain.<br /><p></p><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=d4649bc5-6875-4011-966c-e3a480f558f4" /></body>
      <title>GridView Databinding error  "Field or property ... not found on the selected data source"</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,d4649bc5-6875-4011-966c-e3a480f558f4.aspx</guid>
      <link>http://tim.mackey.ie/GridViewDatabindingErrorFieldOrPropertyNotFoundOnTheSelectedDataSource.aspx</link>
      <pubDate>Wed, 21 Dec 2005 15:51:28 GMT</pubDate>
      <description>&lt;h3&gt;A field or property with the name 'xyz' was not found on the selected data source
&lt;/h3&gt;
I get this error when i bind a GridView to an array of custom objects with public
variables.&amp;nbsp; 
&lt;br&gt;
The recommended pattern for designing classes is to have private variables with public
properties with get/set etc, but for my current application i'm not bothering with
that. Apparently because of the Reflection methods used in GridView databinding, you
have to have properties to bind fields in the GridView to your object fields.&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
bit of a pain.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=d4649bc5-6875-4011-966c-e3a480f558f4" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,d4649bc5-6875-4011-966c-e3a480f558f4.aspx</comments>
      <category>Asp.Net</category>
    </item>
    <item>
      <trackback:ping>http://tim.mackey.ie/Trackback.aspx?guid=57936b67-e421-4aba-a5f0-27fa82d5f880</trackback:ping>
      <pingback:server>http://tim.mackey.ie/pingback.aspx</pingback:server>
      <pingback:target>http://tim.mackey.ie/PermaLink,guid,57936b67-e421-4aba-a5f0-27fa82d5f880.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://tim.mackey.ie/CommentView,guid,57936b67-e421-4aba-a5f0-27fa82d5f880.aspx</wfw:comment>
      <wfw:commentRss>http://tim.mackey.ie/SyndicationService.asmx/GetEntryCommentsRss?guid=57936b67-e421-4aba-a5f0-27fa82d5f880</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">in .net 1.1, the GridCommandEventArgs (or
whatever) used to give access to the row that triggered the command.  
<br />
in .net 2.0, it isn't as obvious as that.  Fritz posted an <a href="http://pluralsight.com/blogs/fritz/archive/2005/06/24/11975.aspx">excellent
discussion</a> on the matter, and i'm just posting his 2-line solution here for reference.<br /><br />
If your button is a ButtonField, then you can access the index of the item via e.CommandArgument. 
This may be enough information to do whatever you need. 
<br /><br />
If your button is a LinkButton in a TemplateField, you have to add the CommandArgument
as an attribute to the LinkButton:<pre>CommandArgument='&lt;%# Eval("id") %&gt;'</pre>Then
in the code behind for RowCommand, you can use the following syntax:<br /><pre>string id = (string)e.CommandArgument;</pre>
thanks Fritz!<br /><img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=57936b67-e421-4aba-a5f0-27fa82d5f880" /></body>
      <title>GridView - accessing row information inside RowCommand</title>
      <guid isPermaLink="false">http://tim.mackey.ie/PermaLink,guid,57936b67-e421-4aba-a5f0-27fa82d5f880.aspx</guid>
      <link>http://tim.mackey.ie/GridViewAccessingRowInformationInsideRowCommand.aspx</link>
      <pubDate>Tue, 20 Dec 2005 17:52:22 GMT</pubDate>
      <description>in .net 1.1, the GridCommandEventArgs (or whatever) used to give access to the row that triggered the command.&amp;nbsp; &lt;br&gt;
in .net 2.0, it isn't as obvious as that.&amp;nbsp; Fritz posted an &lt;a href="http://pluralsight.com/blogs/fritz/archive/2005/06/24/11975.aspx"&gt;excellent
discussion&lt;/a&gt; on the matter, and i'm just posting his 2-line solution here for reference.&lt;br&gt;
&lt;br&gt;
If your button is a ButtonField, then you can access the index of the item via e.CommandArgument.&amp;nbsp;
This may be enough information to do whatever you need. 
&lt;br&gt;
&lt;br&gt;
If your button is a LinkButton in a TemplateField, you have to add the CommandArgument
as an attribute to the LinkButton:&lt;pre&gt;CommandArgument='&amp;lt;%# Eval("id") %&amp;gt;'&lt;/pre&gt;Then
in the code behind for RowCommand, you can use the following syntax:&lt;br&gt;
&lt;pre&gt;string id = (string)e.CommandArgument;&lt;/pre&gt;
thanks Fritz!&lt;br&gt;
&lt;img width="0" height="0" src="http://tim.mackey.ie/aggbug.ashx?id=57936b67-e421-4aba-a5f0-27fa82d5f880" /&gt;</description>
      <comments>http://tim.mackey.ie/CommentView,guid,57936b67-e421-4aba-a5f0-27fa82d5f880.aspx</comments>
      <category>Asp.Net</category>
    </item>
  </channel>
</rss>