<?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>Jeremy Simmons: The Blog - All things Microsoft</title>
    <link>http://www.jeremysimmons.net/blog/</link>
    <description>Four out of Five Coders recommend</description>
    <language>en-us</language>
    <copyright>Jeremy Simmons 2005-2009</copyright>
    <lastBuildDate>Wed, 30 Dec 2009 21:05:44 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>jsimmons@jeremysimmons.net</managingEditor>
    <webMaster>jsimmons@jeremysimmons.net</webMaster>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Here's another error I got today while
using Visual Studio 2008<br /><br />
---------------------------<br />
Microsoft Visual Studio<br />
---------------------------<br />
Error connecting to undo manager of source file 'C:\dev\Work\ReportBrowser\ReportBrowserWeb\SiteLayout.Master.designer.cs'.<br />
---------------------------<br />
OK   
<br />
---------------------------<br /><br />
Found a good solution here<br />
http://www.hanselman.com/blog/CommentView.aspx?guid=8bc798ae-da26-4864-b4e3-b68b081b4be1<br /><br />
1) Right-click the designer file and select delete<br />
2) Right-click the aspx file and select Convert to Web Application<br /><br /><p></p><img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c" /></body>
      <title>Message Box Error and Solution</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/12/30/MessageBoxErrorAndSolution.aspx</link>
      <pubDate>Wed, 30 Dec 2009 21:05:44 GMT</pubDate>
      <description>Here's another error I got today while using Visual Studio 2008&lt;br&gt;
&lt;br&gt;
---------------------------&lt;br&gt;
Microsoft Visual Studio&lt;br&gt;
---------------------------&lt;br&gt;
Error connecting to undo manager of source file 'C:\dev\Work\ReportBrowser\ReportBrowserWeb\SiteLayout.Master.designer.cs'.&lt;br&gt;
---------------------------&lt;br&gt;
OK&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
---------------------------&lt;br&gt;
&lt;br&gt;
Found a good solution here&lt;br&gt;
http://www.hanselman.com/blog/CommentView.aspx?guid=8bc798ae-da26-4864-b4e3-b68b081b4be1&lt;br&gt;
&lt;br&gt;
1) Right-click the designer file and select delete&lt;br&gt;
2) Right-click the aspx file and select Convert to Web Application&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,98c7fedf-ebc4-4e04-a6e3-bad1c433ed5c.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=c3cca6d9-da16-4685-8499-5d49d339ec49</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,c3cca6d9-da16-4685-8499-5d49d339ec49.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,c3cca6d9-da16-4685-8499-5d49d339ec49.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c3cca6d9-da16-4685-8499-5d49d339ec49</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've decided to start a new series of articles on how I solve various problems in
my daily programmer lifee. Usually a problem has a distinct message box that shows
up which you can copy the text of with the CTRL + C key combination. I think that
a lot of people search directly for this text, and it woudl be awesome to have it
solved. Maybe I'll even start a website some day to host these solutions so that people
(or in a perfect world the vendor...) can post a solution to them. For today, here's
my problem that I experienced inside of devenv.exe (Visual Studio 2008) today while
trying to use the Server Explorer to add a new Data Connection. 
</p>
        <p>
---------------------------<br />
Server Explorer<br />
---------------------------<br />
Unable to add data connection.
</p>
        <p>
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The
system cannot find the file specified.<br />
---------------------------<br />
OK   
<br />
---------------------------<br /></p>
        <p>
I was tipped off by this forum post <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&amp;tid=89ee0e86-b8fc-40a7-a0e1-51ac4033302e&amp;cat=en_US_38f7e3d1-40bd-4daf-941f-f45d2ff6ff9b&amp;lang=en&amp;cr=US&amp;sloc=&amp;p=1">http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&amp;tid=89ee0e86-b8fc-40a7-a0e1-51ac4033302e&amp;cat=en_US_38f7e3d1-40bd-4daf-941f-f45d2ff6ff9b&amp;lang=en&amp;cr=US&amp;sloc=&amp;p=1</a></p>
        <p>
to install the SQL Server 2008 Managment Objects and Native Client, which you can
get from here
</p>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;displaylang=en#filelist">http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;displaylang=en#filelist</a>
        </p>
        <p>
Or more specifically, here 
</p>
        <p>
Microsoft SQL Server 2008 Management Objects X86 Package <a href="http://go.microsoft.com/fwlink/?LinkId=123708&amp;clcid=0x409">http://go.microsoft.com/fwlink/?LinkId=123708&amp;clcid=0x409</a></p>
        <p>
Microsoft SQL Server 2008 Native Client X86 Package <a href="http://go.microsoft.com/fwlink/?LinkId=123717&amp;clcid=0x409">http://go.microsoft.com/fwlink/?LinkId=123717&amp;clcid=0x409</a></p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=c3cca6d9-da16-4685-8499-5d49d339ec49" />
      </body>
      <title>Todays Message Box Error and Solution</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,c3cca6d9-da16-4685-8499-5d49d339ec49.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/12/23/TodaysMessageBoxErrorAndSolution.aspx</link>
      <pubDate>Wed, 23 Dec 2009 19:47:21 GMT</pubDate>
      <description>&lt;p&gt;
I've decided to start a new series of articles on how I solve various problems in
my daily programmer lifee. Usually a problem has a distinct message box that shows
up which you can copy the text of with the CTRL + C key combination. I think that
a lot of people search directly for this text, and it woudl be awesome to have it
solved. Maybe I'll even start a website some day to host these solutions so that people
(or in a perfect world the vendor...) can post a solution to them. For today, here's
my problem that I experienced inside of devenv.exe (Visual Studio 2008) today while
trying to use the Server Explorer to add a new Data Connection. 
&lt;/p&gt;
&lt;p&gt;
---------------------------&lt;br&gt;
Server Explorer&lt;br&gt;
---------------------------&lt;br&gt;
Unable to add data connection.
&lt;/p&gt;
&lt;p&gt;
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The
system cannot find the file specified.&lt;br&gt;
---------------------------&lt;br&gt;
OK&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
---------------------------&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
I was tipped off by this forum post &lt;a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&amp;amp;tid=89ee0e86-b8fc-40a7-a0e1-51ac4033302e&amp;amp;cat=en_US_38f7e3d1-40bd-4daf-941f-f45d2ff6ff9b&amp;amp;lang=en&amp;amp;cr=US&amp;amp;sloc=&amp;amp;p=1"&gt;http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.vstudio.general&amp;amp;tid=89ee0e86-b8fc-40a7-a0e1-51ac4033302e&amp;amp;cat=en_US_38f7e3d1-40bd-4daf-941f-f45d2ff6ff9b&amp;amp;lang=en&amp;amp;cr=US&amp;amp;sloc=&amp;amp;p=1&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
to install the SQL Server 2008 Managment Objects and Native Client, which you can
get from here
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;amp;displaylang=en#filelist"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;amp;displaylang=en#filelist&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Or more specifically, here 
&lt;/p&gt;
&lt;p&gt;
Microsoft SQL Server 2008 Management Objects X86 Package &lt;a href="http://go.microsoft.com/fwlink/?LinkId=123708&amp;amp;clcid=0x409"&gt;http://go.microsoft.com/fwlink/?LinkId=123708&amp;amp;clcid=0x409&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Microsoft SQL Server 2008 Native Client X86 Package &lt;a href="http://go.microsoft.com/fwlink/?LinkId=123717&amp;amp;clcid=0x409"&gt;http://go.microsoft.com/fwlink/?LinkId=123717&amp;amp;clcid=0x409&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=c3cca6d9-da16-4685-8499-5d49d339ec49" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,c3cca6d9-da16-4685-8499-5d49d339ec49.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=4335905a-431c-47b1-bb7f-696ebb4bf550</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,4335905a-431c-47b1-bb7f-696ebb4bf550.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,4335905a-431c-47b1-bb7f-696ebb4bf550.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4335905a-431c-47b1-bb7f-696ebb4bf550</wfw:commentRss>
      <title>Databinding to a XmlDataProvider in WPF</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,4335905a-431c-47b1-bb7f-696ebb4bf550.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/10/06/DatabindingToAXmlDataProviderInWPF.aspx</link>
      <pubDate>Tue, 06 Oct 2009 15:46:36 GMT</pubDate>
      <description>I've resolved to start making the shift to WPF. It's about time. The technology has only been around for a good 3+ years. So far, I'm very excited by what I see. An invaluable reference has been &lt;a href="http://www.amazon.com/Programming-WPF-Chris-Sells/dp/0596510373/"&gt;Programming
WPF 2nd edition&lt;/a&gt; by Chris Sells. Specifically the appendices. The explination of
Xaml, and the Xaml Extensions removes the veil of confusion from all of the arcane
looking symbols going on in the Xaml code. Thanks for the awesome book Chris! I was
going through an article published in MSDN Magazine, &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163299.aspx"&gt;Data
Binding in WPF&lt;/a&gt; by John Papa. I encountered a very frustrating bug and I felt the
need to let the next developer know about the solution I uncovered. (The next developer
is sometimes me. I do very much love finding my own posts months or years down the
road that help me out). Maybe this will help you out.&lt;br&gt;
&lt;br&gt;
So, I'm building my Xaml out, and I have a perfectly good XmlDataProvider in my Resources.&lt;br&gt;
&lt;pre&gt;&amp;lt;XmlDataProvider x:Key="MoreColors" XPath="/colors"&amp;gt;&lt;br&gt;
&amp;lt;x:XData&amp;gt;&lt;br&gt;
&amp;lt;colors&amp;gt;&lt;br&gt;
&amp;lt;color name="pink"/&amp;gt;&lt;br&gt;
&amp;lt;color name="white"/&amp;gt;&lt;br&gt;
&amp;lt;color name="black"/&amp;gt;&lt;br&gt;
&amp;lt;color name="cyan"/&amp;gt;&lt;br&gt;
&amp;lt;color name="gray"/&amp;gt;&lt;br&gt;
&amp;lt;color name="magenta"/&amp;gt;&lt;br&gt;
&amp;lt;/colors&amp;gt;&lt;br&gt;
&amp;lt;/x:XData&amp;gt;&lt;br&gt;
&amp;lt;/XmlDataProvider&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
I Created the Binding to my Listbox as such.
&lt;/p&gt;
&lt;pre&gt;
&lt;br&gt;
&lt;/pre&gt;
&lt;pre&gt;
&lt;listbox x:name="lbColor" itemssource="{Binding Source={StaticResource Colors},  XPath=color/@name}"&gt;
&lt;/listbox&gt;
&lt;/pre&gt;
&lt;p&gt;
This whole thing is working in the Designer (Visual Studio 2008), but is displaying &lt;b&gt;nothing&lt;/b&gt; at
runtime. I whisk away to the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.data.xmldataprovider.aspx"&gt;MSDN
Documentation for XmlDataProvider&lt;/a&gt; and find this clever little note.
&lt;/p&gt;
&lt;blockquote&gt; The root node of the XML data has an xmlns attribute that sets the XML
namespace to an empty string. This is a requirement for applying XPath queries to
a data island that is inline within the XAML page. In this inline case, the XAML,
and thus the data island, inherits the System.Windows namespace. Because of this,
you need to set the namespace blank to keep XPath queries from being qualified by
the System.Windows namespace, which would misdirect the queries.&lt;br&gt;
&lt;/blockquote&gt;Is it possible that this is the explination to the Debug output I'm seeing
in Visual Studio at runtime?&lt;p&gt;
&lt;/p&gt;
&lt;pre&gt;System.Windows.Data Error: 47 : XmlDataProvider has inline XML that does not explicitly set its XmlNamespace (xmlns="").&lt;/pre&gt;
&lt;p&gt;
I add the missing &lt;code&gt;xmlns=""&lt;/code&gt; to the root xml element (as shown below),
and things begin to work at runtime.
&lt;/p&gt;
&lt;pre&gt;&amp;lt;XmlDataProvider x:Key="MoreColors" XPath="/colors"&amp;gt;&lt;br&gt;
&amp;lt;x:XData&amp;gt;&lt;br&gt;
&amp;lt;colors xmlns=""&amp;gt;&lt;br&gt;
&amp;lt;color name="pink"/&amp;gt;&lt;br&gt;
&amp;lt;color name="white"/&amp;gt;&lt;/pre&gt;
&lt;p&gt;
In searching for the answer to this solution, I also came across this post &lt;a href="http://blog.wouldbetheologian.com/2009/07/why-wpf-databinding-is-awful-technology.html"&gt;Why
WPF databinding is an awful technology&lt;/a&gt;. I hope this is not shared feeling of frustration
many of us receive by wasted hours of our day with the &lt;a href="http://www.google.fr/"&gt;Moteur
de recherche du jour&lt;/a&gt; (&lt;a href="http://www.google.com/"&gt;search engine of the day&lt;/a&gt;).
It's a really useful tool if you can convince it to give you the right answer, and
people have posted about the particular phrase you're looking for.
&lt;/p&gt;
&lt;p&gt;
Good luck reader, with your journey to WPF enlightenment. It has been worth my time.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=4335905a-431c-47b1-bb7f-696ebb4bf550" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,4335905a-431c-47b1-bb7f-696ebb4bf550.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=09e4e24b-0642-461d-bd8a-5eb537133f1d</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,09e4e24b-0642-461d-bd8a-5eb537133f1d.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,09e4e24b-0642-461d-bd8a-5eb537133f1d.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=09e4e24b-0642-461d-bd8a-5eb537133f1d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When you have a ListView control in Windows Forms, and you don't want the horizontal
scroll bar to show up, you need to set the size of the columns to be the same 'Width'
as the ListView.<br />
What exactly is the 'Width' you should use here? Yes careful reader, I've been quoting
Width because we need to take a closer look at what's going on.<br />
Lets look at a dead simple example to clearly illustrate why this is a concern.<br /><br />
When I create a new Windows Forms application in Visual Studio, I get a standard sized
form. Dragging a ListView control from the toolbox will create a control with the
dimensions defined as 
</p>
        <pre>private void InitializeComponent()
{
   ...
   this.listView1.Size = new System.Drawing.Size(121, 97);
   ...
}</pre>
I added the following code to constructor of the Form after the <code>InitializeComponent()</code> call; <pre>void Form1()
{
   InitializeComponent();
   
   listView1.Columns.Add("Name");
   for (int i = 0; i &lt; 20; i++)
   {
      listView1.Items.Add(new string((char)(i + 33), 10));
   }
   // Naive width
   listView1.Columns[0].Width = listView1.Width;
}</pre><p>
What we end up with looks like the image below.
</p><p><img src="http://www.jeremysimmons.net/blog/content/binary/listview1.PNG" border="0" /></p><p>
This is definately not what we wanted. Even though none of my data is forcing my scroll
behavior, my column definition definitely is. I could change this to use the ClientSize
of the Control, I know that's smaller. The documentation on MSDN for <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.clientsize.aspx"> Control.ClientSize</a> makes
these remarks about the property. 
</p><blockquote> "The client area of a control is the bounds of the control, minus the
nonclient elements such as scroll bars, borders, title bars, and menus..." </blockquote> This
will work right? I'll just make a quick change to the code, recompile and... drat.
No love. <pre>    // Setting the width on the Column
   //<strike>listView1.Columns[0].Width
= listView1.Width;</strike> //listView1.Columns[0].Width = listView1.ClientSize.Width; 
<br />
}</pre><p>
What is going on here?!<br />
As it turns out, the calculation for ClientSize in the constructor is completely correct.
The control hasn't been drawn yet, and it has no knowledge of whether it will need
to use a vertical scrollbar to display the data. That's just fine control. I know
how to fix you. I know how wide a scroll bar is, and I can figure that out on my own...
Just watch me.
</p><pre>   // Setting the width on the Column
   //<strike>listView1.Columns[0].Width
= listView1.Width;</strike> //<strike>listView1.Columns[0].Width = listView1.ClientSize.Width;</strike> listView1.Columns[0].Width
= listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth; }</pre><p>
Ha! Take that ListView. Now my column displays perfectly, and I have no Horizontal
ScrollBar to contend with. Just to prove it to you, I'm going to check how wide it
should be after the form shows up, to make sure I'm right...
</p><pre>      //<strike>listView1.Columns[0].Width = listView1.Width;</strike> //<strike>listView1.Columns[0].Width
= listView1.ClientSize.Width;</strike> Debug.Print("ListView is {0} px wide and has
a client width of {1} px", listView1.Width, listView1.ClientSize.Width); Debug.Print("VerticalScrollBarWidth:
{0}", SystemInformation.VerticalScrollBarWidth); Debug.Print("Calculated width: {0}",
listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth); listView1.Columns[0].Width
= listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth; this.Load
+= new EventHandler(Form1_Load); } void Form1_Load(object sender, EventArgs e) { Debug.Print("Loaded
width: {0}", listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth);
} </pre>
Debug Output: <pre>ListView is 121 px wide and has a client width of 117 px
VerticalScrollBarWidth: 17
Calculated width: 100
Loaded width: 100
</pre><p>
Uh-oh. I have a bad feeling. It seems like the Width of the ClientSize after the control
has been painted is different than before it was painted. Could it be that when the
VerticalScrollBar is painted, the control does in fact know how much room it has left
to use to paint on the screen?! Isn't that in fact, exactly what the Remarks of the
ClientSize property told me? Do the numbers above not in fact make perfect sense!?
Is 117 - 17 = 100?! Yes... sigh. Perhaps I should have meditated on the implications
that the remarks on MSDN were accurate from the begging. 
</p><blockquote> "The client area of a control is the bounds of the control, <strong>minus
the nonclient elements such as scroll bars, borders, title bars, and menus</strong>..." </blockquote><p>
As it turns out, the correct time to set the width of a ListView Column is AFTER you've
determined that there will be scrollbars painted on the control.
</p><img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=09e4e24b-0642-461d-bd8a-5eb537133f1d" /></body>
      <title>How to remove the horizontal scrollbar from a ListView</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,09e4e24b-0642-461d-bd8a-5eb537133f1d.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/10/01/HowToRemoveTheHorizontalScrollbarFromAListView.aspx</link>
      <pubDate>Thu, 01 Oct 2009 16:05:19 GMT</pubDate>
      <description>&lt;p&gt;
When you have a ListView control in Windows Forms, and you don't want the horizontal
scroll bar to show up, you need to set the size of the columns to be the same 'Width'
as the ListView.&lt;br&gt;
What exactly is the 'Width' you should use here? Yes careful reader, I've been quoting
Width because we need to take a closer look at what's going on.&lt;br&gt;
Lets look at a dead simple example to clearly illustrate why this is a concern.&lt;br&gt;
&lt;br&gt;
When I create a new Windows Forms application in Visual Studio, I get a standard sized
form. Dragging a ListView control from the toolbox will create a control with the
dimensions defined as 
&lt;/p&gt;
&lt;pre&gt;private void InitializeComponent()
{
   ...
   this.listView1.Size = new System.Drawing.Size(121, 97);
   ...
}&lt;/pre&gt;
I added the following code to constructor of the Form after the &lt;code&gt;InitializeComponent()&lt;/code&gt; call; &lt;pre&gt;void Form1()
{
   InitializeComponent();
   
   listView1.Columns.Add("Name");
   for (int i = 0; i &amp;lt; 20; i++)
   {
      listView1.Items.Add(new string((char)(i + 33), 10));
   }
   // Naive width
   listView1.Columns[0].Width = listView1.Width;
}&lt;/pre&gt;
&lt;p&gt;
What we end up with looks like the image below.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.jeremysimmons.net/blog/content/binary/listview1.PNG" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
This is definately not what we wanted. Even though none of my data is forcing my scroll
behavior, my column definition definitely is. I could change this to use the ClientSize
of the Control, I know that's smaller. The documentation on MSDN for &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.clientsize.aspx"&gt; Control.ClientSize&lt;/a&gt; makes
these remarks about the property. 
&lt;/p&gt;
&lt;blockquote&gt; "The client area of a control is the bounds of the control, minus the
nonclient elements such as scroll bars, borders, title bars, and menus..." &lt;/blockquote&gt; This
will work right? I'll just make a quick change to the code, recompile and... drat.
No love. &lt;pre&gt;    // Setting the width on the Column
   //&lt;strike&gt;listView1.Columns[0].Width
= listView1.Width;&lt;/strike&gt; //listView1.Columns[0].Width = listView1.ClientSize.Width; 
&lt;br&gt;
}&lt;/pre&gt;
&lt;p&gt;
What is going on here?!&lt;br&gt;
As it turns out, the calculation for ClientSize in the constructor is completely correct.
The control hasn't been drawn yet, and it has no knowledge of whether it will need
to use a vertical scrollbar to display the data. That's just fine control. I know
how to fix you. I know how wide a scroll bar is, and I can figure that out on my own...
Just watch me.
&lt;/p&gt;
&lt;pre&gt;   // Setting the width on the Column
   //&lt;strike&gt;listView1.Columns[0].Width
= listView1.Width;&lt;/strike&gt; //&lt;strike&gt;listView1.Columns[0].Width = listView1.ClientSize.Width;&lt;/strike&gt; listView1.Columns[0].Width
= listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth; }&lt;/pre&gt;
&lt;p&gt;
Ha! Take that ListView. Now my column displays perfectly, and I have no Horizontal
ScrollBar to contend with. Just to prove it to you, I'm going to check how wide it
should be after the form shows up, to make sure I'm right...
&lt;/p&gt;
&lt;pre&gt;      //&lt;strike&gt;listView1.Columns[0].Width = listView1.Width;&lt;/strike&gt; //&lt;strike&gt;listView1.Columns[0].Width
= listView1.ClientSize.Width;&lt;/strike&gt; Debug.Print("ListView is {0} px wide and has
a client width of {1} px", listView1.Width, listView1.ClientSize.Width); Debug.Print("VerticalScrollBarWidth:
{0}", SystemInformation.VerticalScrollBarWidth); Debug.Print("Calculated width: {0}",
listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth); listView1.Columns[0].Width
= listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth; this.Load
+= new EventHandler(Form1_Load); } void Form1_Load(object sender, EventArgs e) { Debug.Print("Loaded
width: {0}", listView1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth);
} &lt;/pre&gt;
Debug Output: &lt;pre&gt;ListView is 121 px wide and has a client width of 117 px
VerticalScrollBarWidth: 17
Calculated width: 100
Loaded width: 100
&lt;/pre&gt;
&lt;p&gt;
Uh-oh. I have a bad feeling. It seems like the Width of the ClientSize after the control
has been painted is different than before it was painted. Could it be that when the
VerticalScrollBar is painted, the control does in fact know how much room it has left
to use to paint on the screen?! Isn't that in fact, exactly what the Remarks of the
ClientSize property told me? Do the numbers above not in fact make perfect sense!?
Is 117 - 17 = 100?! Yes... sigh. Perhaps I should have meditated on the implications
that the remarks on MSDN were accurate from the begging. 
&lt;/p&gt;
&lt;blockquote&gt; "The client area of a control is the bounds of the control, &lt;strong&gt;minus
the nonclient elements such as scroll bars, borders, title bars, and menus&lt;/strong&gt;..." &lt;/blockquote&gt; 
&lt;p&gt;
As it turns out, the correct time to set the width of a ListView Column is AFTER you've
determined that there will be scrollbars painted on the control.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=09e4e24b-0642-461d-bd8a-5eb537133f1d" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,09e4e24b-0642-461d-bd8a-5eb537133f1d.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=339466b2-abc5-4812-8384-7de731e521c7</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,339466b2-abc5-4812-8384-7de731e521c7.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,339466b2-abc5-4812-8384-7de731e521c7.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=339466b2-abc5-4812-8384-7de731e521c7</wfw:commentRss>
      <slash:comments>29</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I went to the MSDN Unleashed: The Best
of PDC event at ConfigureSoft. <a href="http://blog.davidyack.com/">David Yack</a> and <a href="http://blogs.msdn.com/bags/">Rob
Bagby</a> were presenting on the topics originally presented at PDC<br /><ul><li>
What to expect with C# 4.0</li><ul><li>
It's really just the distilled content that has been <a href="http://code.msdn.microsoft.com/csharpfuture/">available
since October</a>. You could hear it straight from <a href="http://channel9.msdn.com/pdc2008/TL16/">Anders</a> himself.
Dave did an awesome job though.<br /></li></ul><li>
The Silverlight Control Toolkit 
<br /></li><ul><li>
Microsoft is releasing code out of band for <a href="http://www.codeplex.com/Silverlight">Silverlight</a> for
those who wish to live on the edge<br /></li></ul><li>
REST with WCF and the WCF REST Starter Kit</li><ul><li>
Creating a REST-ful web service is dead simple using WCF. Add to it the starter kit
and you get all sorts of free goodies out of the box to making even more dead simple.
Once again, "It Just Works"<br /></li></ul><li>
Overview of Windows Azure (“The Cloud OS”) and Azure Services 
</li><ul><li>
Azure = a cloud operating system + a set of developer services. Somethings you just
gotta have a platform to write scalable apps on without worrying about the infrastructure. 
<br /></li></ul></ul>
We got some awesome "Rest in WCF" t-shirts with a photo of Rob's dog on it. I'm going
to have to hang it on the wall so everyone will ask why I have a sleeping dog on a
shirt. It's all because of Representational State Transfer of course! 
<br /><br />
Rob had some very funny lines I will quote often in the future as well.<br /><br /><blockquote>Like the guy on the Ginsu knife commercial says, But that's not all you
get<br /></blockquote><blockquote>...that's a potentially marriage limiting maneuver...<br /></blockquote>Thanks for the great presentation gentlemen. Thanks to Microsoft for
continuing these events. They're a great way to digest the information.<br /><img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=339466b2-abc5-4812-8384-7de731e521c7" /></body>
      <title>Memories from MSDN Unleashed: The Best of PDC event</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,339466b2-abc5-4812-8384-7de731e521c7.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/01/28/MemoriesFromMSDNUnleashedTheBestOfPDCEvent.aspx</link>
      <pubDate>Wed, 28 Jan 2009 16:42:35 GMT</pubDate>
      <description>I went to the MSDN Unleashed: The Best of PDC event at ConfigureSoft. &lt;a href="http://blog.davidyack.com/"&gt;David
Yack&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/bags/"&gt;Rob Bagby&lt;/a&gt; were presenting on
the topics originally presented at PDC&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
What to expect with C# 4.0&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
It's really just the distilled content that has been &lt;a href="http://code.msdn.microsoft.com/csharpfuture/"&gt;available
since October&lt;/a&gt;. You could hear it straight from &lt;a href="http://channel9.msdn.com/pdc2008/TL16/"&gt;Anders&lt;/a&gt; himself.
Dave did an awesome job though.&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
The Silverlight Control Toolkit 
&lt;br&gt;
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Microsoft is releasing code out of band for &lt;a href="http://www.codeplex.com/Silverlight"&gt;Silverlight&lt;/a&gt; for
those who wish to live on the edge&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
REST with WCF and the WCF REST Starter Kit&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Creating a REST-ful web service is dead simple using WCF. Add to it the starter kit
and you get all sorts of free goodies out of the box to making even more dead simple.
Once again, "It Just Works"&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Overview of Windows Azure (“The Cloud OS”) and Azure Services 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Azure = a cloud operating system + a set of developer services. Somethings you just
gotta have a platform to write scalable apps on without worrying about the infrastructure. 
&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
We got some awesome "Rest in WCF" t-shirts with a photo of Rob's dog on it. I'm going
to have to hang it on the wall so everyone will ask why I have a sleeping dog on a
shirt. It's all because of Representational State Transfer of course! 
&lt;br&gt;
&lt;br&gt;
Rob had some very funny lines I will quote often in the future as well.&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;Like the guy on the Ginsu knife commercial says, But that's not all you
get&lt;br&gt;
&lt;/blockquote&gt;&lt;blockquote&gt;...that's a potentially marriage limiting maneuver...&lt;br&gt;
&lt;/blockquote&gt;Thanks for the great presentation gentlemen. Thanks to Microsoft for
continuing these events. They're a great way to digest the information.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=339466b2-abc5-4812-8384-7de731e521c7" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,339466b2-abc5-4812-8384-7de731e521c7.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=88dd418c-c27c-4a52-b441-6e3010684b6d</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,88dd418c-c27c-4a52-b441-6e3010684b6d.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,88dd418c-c27c-4a52-b441-6e3010684b6d.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=88dd418c-c27c-4a52-b441-6e3010684b6d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently did a MSBuild script for a colleage to zip some files and move them to
a file server and email them to two recipients.<br />
The script should only run on a specific day (Sunday), and fail with an error if it
is not that day.<br />
Using the <a href="http://msbuildtasks.tigris.org/">MSBuild Community Tasks Project</a> from <a href="http://www.tigris.org/">Tigris</a> makes
this a trivial exercise.
</p>
        <pre>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"&gt;

  &lt;Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/&gt;

  &lt;Target Name="Build"&gt;
    &lt;Time&gt;
      &lt;Output TaskParameter="DayOfWeek" PropertyName="DayOfWeek" /&gt;
    &lt;/Time&gt;
    &lt;Message Text="It's Monday!" Condition=" '$(DayOfWeek)'=='Monday' "/&gt;
    &lt;Message Text="It's Tuesday!" Condition=" '$(DayOfWeek)'=='Tuesday' "/&gt;
    &lt;Error Code="1" ContinueOnError="false" Condition="'$(DayOfWeek)'=='Monday'" Text="Stop everything, it's monday!"/&gt;
    &lt;Message Text="Everything is ok"/&gt;
  &lt;/Target&gt;
&lt;/Project&gt;
</pre>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=88dd418c-c27c-4a52-b441-6e3010684b6d" />
      </body>
      <title>MSBuild fail on specific days</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,88dd418c-c27c-4a52-b441-6e3010684b6d.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2009/01/21/MSBuildFailOnSpecificDays.aspx</link>
      <pubDate>Wed, 21 Jan 2009 18:20:59 GMT</pubDate>
      <description>&lt;p&gt;
I recently did a MSBuild script for a colleage to zip some files and move them to
a file server and email them to two recipients.&lt;br&gt;
The script should only run on a specific day (Sunday), and fail with an error if it
is not that day.&lt;br&gt;
Using the &lt;a href="http://msbuildtasks.tigris.org/"&gt;MSBuild Community Tasks Project&lt;/a&gt; from &lt;a href="http://www.tigris.org/"&gt;Tigris&lt;/a&gt; makes
this a trivial exercise.
&lt;/p&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;
&amp;lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"&amp;gt;

  &amp;lt;Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/&amp;gt;

  &amp;lt;Target Name="Build"&amp;gt;
    &amp;lt;Time&amp;gt;
      &amp;lt;Output TaskParameter="DayOfWeek" PropertyName="DayOfWeek" /&amp;gt;
    &amp;lt;/Time&amp;gt;
    &amp;lt;Message Text="It's Monday!" Condition=" '$(DayOfWeek)'=='Monday' "/&amp;gt;
    &amp;lt;Message Text="It's Tuesday!" Condition=" '$(DayOfWeek)'=='Tuesday' "/&amp;gt;
    &amp;lt;Error Code="1" ContinueOnError="false" Condition="'$(DayOfWeek)'=='Monday'" Text="Stop everything, it's monday!"/&amp;gt;
    &amp;lt;Message Text="Everything is ok"/&amp;gt;
  &amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;
&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=88dd418c-c27c-4a52-b441-6e3010684b6d" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,88dd418c-c27c-4a52-b441-6e3010684b6d.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=522b4b11-75e4-4902-94a3-0211a32cb5cf</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,522b4b11-75e4-4902-94a3-0211a32cb5cf.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,522b4b11-75e4-4902-94a3-0211a32cb5cf.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=522b4b11-75e4-4902-94a3-0211a32cb5cf</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I use C# on a daily basis to do most of my coding. 
<br /></p>
        <p>
I really don't like #region directives. It's not just a love-hate thing. I really
hate it. I have a compulsive need to eliminate them. It's extra fluff that really
doesn't need to be in the in the code to make the code any more meaningful. It doesn't
add any value to the executable bits.<br /></p>
        <p>
Using Find/Replace always gets tedius. Why not just remove all instances of it throughout
the solution in one action?
</p>
        <p>
Imports System<br />
Imports EnvDTE<br />
Imports EnvDTE80<br />
Imports EnvDTE90<br />
Imports System.Diagnostics<br /><br />
Public Module CodeHelper<br /><br />
    Public Sub RemoveRegions()<br />
        RemoveThisRegexFromSolution("\#region.+")<br />
        RemoveThisRegexFromSolution("\#endregion")<br />
    End Sub<br /><br />
    Public Sub RemoveThisRegexFromSolution(ByVal findRegex As String)<br /><br />
        DTE.Windows.Item(Constants.vsWindowKindFindReplace).Activate()
'Find and Replace<br />
        DTE.Find.FindWhat = findRegex<br />
        DTE.Find.ReplaceWith = ""<br />
        DTE.Find.Target = vsFindTarget.vsFindTargetFiles<br />
        DTE.Find.MatchCase = False<br />
        DTE.Find.MatchWholeWord = False<br />
        DTE.Find.MatchInHiddenText = True<br />
        DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr<br />
        DTE.Find.SearchPath = "Entire Solution"<br />
        DTE.Find.SearchSubfolders = True<br />
        DTE.Find.KeepModifiedDocumentsOpen = False<br />
        DTE.Find.FilesOfType = "*.*"<br />
        DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1<br />
        DTE.Find.Action = vsFindAction.vsFindActionReplaceAll<br /><br />
        DTE.Find.Execute() ' Do it<br /><br />
        DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()
' Close the box<br /><br />
    End Sub<br /><br />
End Module
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=522b4b11-75e4-4902-94a3-0211a32cb5cf" />
      </body>
      <title>Utterly Destroy #regions</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,522b4b11-75e4-4902-94a3-0211a32cb5cf.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2008/09/05/UtterlyDestroyRegions.aspx</link>
      <pubDate>Fri, 05 Sep 2008 16:22:12 GMT</pubDate>
      <description>&lt;p&gt;
I use C# on a daily basis to do most of my coding. 
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
I really don't like #region directives. It's not just a love-hate thing. I really
hate it. I have a compulsive need to eliminate them. It's extra fluff that really
doesn't need to be in the in the code to make the code any more meaningful. It doesn't
add any value to the executable bits.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
Using Find/Replace always gets tedius. Why not just remove all instances of it throughout
the solution in one action?
&lt;/p&gt;
&lt;p&gt;
Imports System&lt;br&gt;
Imports EnvDTE&lt;br&gt;
Imports EnvDTE80&lt;br&gt;
Imports EnvDTE90&lt;br&gt;
Imports System.Diagnostics&lt;br&gt;
&lt;br&gt;
Public Module CodeHelper&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub RemoveRegions()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RemoveThisRegexFromSolution("\#region.+")&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RemoveThisRegexFromSolution("\#endregion")&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub RemoveThisRegexFromSolution(ByVal findRegex As String)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Windows.Item(Constants.vsWindowKindFindReplace).Activate()
'Find and Replace&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.FindWhat = findRegex&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.ReplaceWith = ""&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.Target = vsFindTarget.vsFindTargetFiles&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.MatchCase = False&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.MatchWholeWord = False&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.MatchInHiddenText = True&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.SearchPath = "Entire Solution"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.SearchSubfolders = True&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.KeepModifiedDocumentsOpen = False&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.FilesOfType = "*.*"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.Action = vsFindAction.vsFindActionReplaceAll&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Find.Execute() ' Do it&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()
' Close the box&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br&gt;
&lt;br&gt;
End Module
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=522b4b11-75e4-4902-94a3-0211a32cb5cf" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,522b4b11-75e4-4902-94a3-0211a32cb5cf.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=e722bd9e-4e5b-40a8-9867-932002dac07b</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,e722bd9e-4e5b-40a8-9867-932002dac07b.aspx</pingback:target>
      <dc:creator>Jeremy Simmons</dc:creator>
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,e722bd9e-4e5b-40a8-9867-932002dac07b.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e722bd9e-4e5b-40a8-9867-932002dac07b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
What was that format string again? You know, the one for the GUID where you only output
the guid, but with no formatting?
</p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">using</span> System;<br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">public</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">class</span> GuidTest<br />
{<br />
    <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">public</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">static</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">void</span> Main()<br />
    {<br />
        <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span>[]
guidFormats <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> {<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"N"</span>, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"D"</span>, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"B"</span>, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"P"</span>};<br />
        Guid g <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> Guid();<br />
        Array.ForEach(guidFormats, <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">delegate</span>(<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span> t)<br />
        {<br />
            Console.WriteLine(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"{0}:{1}"</span>,
t, g.ToString(t));<br />
        });<br />
        Console.ReadLine();<br />
    }<br />
}</span>
        </p>
        <pre>N:00000000000000000000000000000000
D:00000000-0000-0000-0000-000000000000
B:{00000000-0000-0000-0000-000000000000}
P:(00000000-0000-0000-0000-000000000000)</pre>
        <p>
That's right. Now I remember.
</p>
        <p>
Edit: 1/8/2010 - I've forgotten again... Darn.
</p>
        <p>
I should create a <a href="http://en.wikipedia.org/wiki/Mnemonic">mnemonic device</a> to
remember this
</p>
        <p>
N = Nothing
</p>
        <p>
D = Dashes
</p>
        <p>
B = Brackets
</p>
        <p>
P = Parenthesis
</p>
        <p>
http://msdn.microsoft.com/en-us/system.guid.tostring.aspx<br /></p>
        <p>
          <br />
        </p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=e722bd9e-4e5b-40a8-9867-932002dac07b" />
      </body>
      <title>What Was That Format String Again You Know The One For The GUID Where You Only Output The Guid But With No Formatting</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,e722bd9e-4e5b-40a8-9867-932002dac07b.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2008/04/22/WhatWasThatFormatStringAgainYouKnowTheOneForTheGUIDWhereYouOnlyOutputTheGuidButWithNoFormatting.aspx</link>
      <pubDate>Tue, 22 Apr 2008 16:03:45 GMT</pubDate>
      <description>&lt;p&gt;
What was that format string again? You know, the one for the GUID where you only output
the guid, but with no formatting?
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;"&gt;&lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;using&lt;/span&gt; System;&lt;br&gt;
&lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;public&lt;/span&gt; &lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;class&lt;/span&gt; GuidTest&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;public&lt;/span&gt; &lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;static&lt;/span&gt; &lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;void&lt;/span&gt; Main()&lt;br&gt;
&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;&lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;string&lt;/span&gt;[]
guidFormats &lt;span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;"&gt;=&lt;/span&gt; {&lt;span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);"&gt;"N"&lt;/span&gt;, &lt;span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);"&gt;"D"&lt;/span&gt;, &lt;span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);"&gt;"B"&lt;/span&gt;, &lt;span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);"&gt;"P"&lt;/span&gt;};&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Guid g &lt;span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;"&gt;=&lt;/span&gt; &lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;new&lt;/span&gt; Guid();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Array.ForEach(guidFormats, &lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;delegate&lt;/span&gt;(&lt;span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;"&gt;string&lt;/span&gt; t)&lt;br&gt;
&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;Console.WriteLine(&lt;span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);"&gt;"{0}:{1}"&lt;/span&gt;,
t, g.ToString(t));&lt;br&gt;
&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;Console.ReadLine();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;/span&gt;
&lt;/p&gt;
&lt;pre&gt;N:00000000000000000000000000000000
D:00000000-0000-0000-0000-000000000000
B:{00000000-0000-0000-0000-000000000000}
P:(00000000-0000-0000-0000-000000000000)&lt;/pre&gt;
&lt;p&gt;
That's right. Now I remember.
&lt;/p&gt;
&lt;p&gt;
Edit: 1/8/2010 - I've forgotten again... Darn.
&lt;/p&gt;
&lt;p&gt;
I should create a &lt;a href="http://en.wikipedia.org/wiki/Mnemonic"&gt;mnemonic device&lt;/a&gt; to
remember this
&lt;/p&gt;
&lt;p&gt;
N = Nothing
&lt;/p&gt;
&lt;p&gt;
D = Dashes
&lt;/p&gt;
&lt;p&gt;
B = Brackets
&lt;/p&gt;
&lt;p&gt;
P = Parenthesis
&lt;/p&gt;
&lt;p&gt;
http://msdn.microsoft.com/en-us/system.guid.tostring.aspx&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=e722bd9e-4e5b-40a8-9867-932002dac07b" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,e722bd9e-4e5b-40a8-9867-932002dac07b.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=6829bc79-baab-4dcc-a6e6-02c2b034347d</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,6829bc79-baab-4dcc-a6e6-02c2b034347d.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,6829bc79-baab-4dcc-a6e6-02c2b034347d.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6829bc79-baab-4dcc-a6e6-02c2b034347d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A colleage approached me and asked how he could convert some ASP Classic code to ASP.Net
2.
</p>
        <p>
Here's the snippet
</p>
        <p>
Dim user 'DOMAIN\USERNAME
</p>
        <p>
Const DomainAuthority = "dc.hq.domain.com"
</p>
        <p>
user = Request.ServerVariables("AUTH_USER") ' BASIC Authentication
</p>
        <p>
user = Mid(user, InStr(user, "\") + 1)
</p>
        <p>
Set user = GetObject("WINNT://" &amp; DomainAuthority &amp; "/" &amp; user)
</p>
        <p>
For Each grp in user.Groups
</p>
        <p>
   If grp.Name = "GroupName1" Then GroupFlag1 = True
</p>
        <p>
   If grp.Name = "GroupName2" Then GroupFlag2 = True
</p>
        <p>
Next
</p>
        <p>
This doesn't compile in a VB.Net web-app.
</p>
        <p>
In order to fix this, lets first add a reference to the types we're using.
</p>
        <p>
At the project level in the Solution Explorer, right click and select Add Reference
</p>
        <p>
          <img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTSolutionExplorer.png" border="0" />
        </p>
        <p>
Switch to the COM tab, and Choose the "Active DS Type Library"
</p>
        <p>
          <img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTLibraryBrowser.png" border="0" />
        </p>
        <p>
This will automagically add some things to your project.
</p>
        <p>
          <img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTSolutionExplorerBin.png" border="0" />
        </p>
        <p>
These are the magical COM Interop DLLs that are generated for you, and allow you to
use the objects inside that library. 
<br />
Dim up a few objects, to use a bit later. 
</p>
        <p>
          <code class="vbnet">Dim usr As IADsUser<br />
Dim grp As IADsGroup </code>
        </p>
        <p>
Set a reference to your user the same as always, using the WinNT ADSI provider.
</p>
        <p>
          <code class="vbnet">usr = GetObject("WINNT://" &amp; TheDC &amp; "/" &amp; UsrName) </code>
        </p>
        <p>
          <span class="686220716-24052007">Now that the compiler knows what the grp object's
type is, it won't puke on you</span>
        </p>
        <p>
          <code class="vbnet">For Each grp In usr.Groups()<br />
  If (grp.Name = "foo" Or grp.Name = "bar") Then<br />
    ' Do something with it<br />
  End If<br />
Next<br /></code>
        </p>
        <p>
There are better ways to do this though, Stay tuned for how to totally pimp this out,
the ASP.Net 2.0 way.
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=6829bc79-baab-4dcc-a6e6-02c2b034347d" />
      </body>
      <title>Group Membership in .net</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,6829bc79-baab-4dcc-a6e6-02c2b034347d.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2007/05/24/GroupMembershipInNet.aspx</link>
      <pubDate>Thu, 24 May 2007 17:18:41 GMT</pubDate>
      <description>&lt;p&gt;
A colleage approached me and asked how he could convert some ASP Classic code to ASP.Net
2.
&lt;/p&gt;
&lt;p&gt;
Here's the snippet
&lt;/p&gt;
&lt;p&gt;
Dim user 'DOMAIN\USERNAME
&lt;/p&gt;
&lt;p&gt;
Const DomainAuthority = "dc.hq.domain.com"
&lt;/p&gt;
&lt;p&gt;
user = Request.ServerVariables("AUTH_USER") ' BASIC Authentication
&lt;/p&gt;
&lt;p&gt;
user = Mid(user, InStr(user, "\") + 1)
&lt;/p&gt;
&lt;p&gt;
Set user = GetObject("WINNT://" &amp;amp; DomainAuthority &amp;amp; "/" &amp;amp; user)
&lt;/p&gt;
&lt;p&gt;
For Each grp in user.Groups
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;If grp.Name = "GroupName1" Then GroupFlag1 = True
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp; If grp.Name = "GroupName2" Then GroupFlag2 = True
&lt;/p&gt;
&lt;p&gt;
Next
&lt;/p&gt;
&lt;p&gt;
This doesn't compile in a VB.Net web-app.
&lt;/p&gt;
&lt;p&gt;
In order to fix this, lets first add a reference to the types we're using.
&lt;/p&gt;
&lt;p&gt;
At the project level in the Solution Explorer, right click and select Add Reference
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTSolutionExplorer.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Switch to the COM tab, and Choose the "Active DS Type Library"
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTLibraryBrowser.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
This will automagically add some things to your project.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.jeremysimmons.net/blog/content/binary/ADSIWinNTSolutionExplorerBin.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
These are the magical COM Interop DLLs that are generated for you, and allow you to
use the objects inside that library. 
&lt;br&gt;
Dim up a few objects, to use a bit later. 
&lt;/p&gt;
&lt;p&gt;
&lt;code class=vbnet&gt;Dim usr As IADsUser&lt;br&gt;
Dim grp As IADsGroup &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Set a reference to your user the same as always, using the WinNT ADSI provider.
&lt;/p&gt;
&lt;p&gt;
&lt;code class=vbnet&gt;usr = GetObject("WINNT://" &amp;amp; TheDC &amp;amp; "/" &amp;amp; UsrName) &lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class=686220716-24052007&gt;Now that the compiler knows what the grp object's type
is, it won't puke on you&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;code class=vbnet&gt;For Each grp In usr.Groups()&lt;br&gt;
&amp;nbsp; If (grp.Name = "foo" Or grp.Name = "bar") Then&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Do something with it&lt;br&gt;
&amp;nbsp; End If&lt;br&gt;
Next&lt;br&gt;
&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
There are better ways to do this though, Stay tuned for how to totally pimp this out,
the ASP.Net 2.0 way.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=6829bc79-baab-4dcc-a6e6-02c2b034347d" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,6829bc79-baab-4dcc-a6e6-02c2b034347d.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=9f893b36-89aa-4e06-8d03-8ce3944fe883</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,9f893b36-89aa-4e06-8d03-8ce3944fe883.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,9f893b36-89aa-4e06-8d03-8ce3944fe883.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9f893b36-89aa-4e06-8d03-8ce3944fe883</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If Not InStr(1, WScript.Fullname, "cscript.exe") = 0 Then<br />
 Dim WshShell<br />
 Set WshShell = WScript.CreateObject("WScript.Shell")<br />
 Call WshShell.Popup("Use this syntax: cscript " &amp; WScript.ScriptFullName,
5, "Error", 0)<br />
 WScript.Quit<br />
End If<br />
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<br />
Const olFolderInbox = 6
</p>
        <p>
Dim myolApp 'As Outlook.Application<br />
Dim myNamespace 'As Outlook.NameSpace<br />
Dim myInbox ' As MAPIFolder<br />
Dim sycs 'As Outlook.SyncObjects<br />
Dim syc 'As Outlook.SyncObject
</p>
        <p>
' Setup Outlook<br />
Set myolApp = CreateObject("Outlook.Application")<br />
If Err Then 
<br />
    WScript.StdOut.Writeline "Could not create Outlook Application!" 
<br />
    WScript.Quit 
<br />
End If 
</p>
        <p>
' Setup the default MAPI namespace<br />
Set myNamespace = myolApp.GetNamespace("MAPI")<br />
If Err Then 
<br />
    WScript.StdOut.Writeline "Could not create MAPI Namespace!" 
<br />
    WScript.Quit 
<br />
End If 
</p>
        <p>
' Force a send/receive<br />
' Start Syncing (send/receive groups)<br />
Set sycs = myNamespace.SyncObjects<br />
For i = 1 To sycs.Count<br />
 Set syc = sycs.Item(i)<br />
 WScript.StdOut.Writeline "Starting send/receive on " &amp; syc.Name<br />
 syc.Start<br />
Next
</p>
        <p>
WScript.StdOut.Writeline "Retreiving unread count"<br />
Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox)
</p>
        <p>
WScript.StdOut.Writeline "There are " &amp; myInbox.UnReadItemCount &amp; " unread
messages"<br />
WScript.Quit myInbox.UnReadItemCount
</p>
        <p>
' Return code == 0 means there is no unread mail. 
<br />
' Return code != 0 means there is that many read mail.
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=9f893b36-89aa-4e06-8d03-8ce3944fe883" />
      </body>
      <title>Checking for even 1 unread message Using Outlook as a client</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,9f893b36-89aa-4e06-8d03-8ce3944fe883.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2007/04/09/CheckingForEven1UnreadMessageUsingOutlookAsAClient.aspx</link>
      <pubDate>Mon, 09 Apr 2007 14:03:47 GMT</pubDate>
      <description>&lt;p&gt;
If Not InStr(1, WScript.Fullname, "cscript.exe") = 0 Then&lt;br&gt;
&amp;nbsp;Dim WshShell&lt;br&gt;
&amp;nbsp;Set WshShell = WScript.CreateObject("WScript.Shell")&lt;br&gt;
&amp;nbsp;Call WshShell.Popup("Use this syntax: cscript " &amp;amp; WScript.ScriptFullName,
5, "Error", 0)&lt;br&gt;
&amp;nbsp;WScript.Quit&lt;br&gt;
End If&lt;br&gt;
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&lt;br&gt;
Const olFolderInbox = 6
&lt;/p&gt;
&lt;p&gt;
Dim myolApp 'As Outlook.Application&lt;br&gt;
Dim myNamespace 'As Outlook.NameSpace&lt;br&gt;
Dim myInbox ' As MAPIFolder&lt;br&gt;
Dim sycs 'As Outlook.SyncObjects&lt;br&gt;
Dim syc 'As Outlook.SyncObject
&lt;/p&gt;
&lt;p&gt;
' Setup Outlook&lt;br&gt;
Set myolApp = CreateObject("Outlook.Application")&lt;br&gt;
If Err Then 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.StdOut.Writeline "Could not create Outlook Application!" 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Quit 
&lt;br&gt;
End If 
&lt;/p&gt;
&lt;p&gt;
' Setup the default MAPI namespace&lt;br&gt;
Set myNamespace = myolApp.GetNamespace("MAPI")&lt;br&gt;
If Err Then 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.StdOut.Writeline "Could not create MAPI Namespace!" 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Quit 
&lt;br&gt;
End If 
&lt;/p&gt;
&lt;p&gt;
' Force a send/receive&lt;br&gt;
' Start Syncing (send/receive groups)&lt;br&gt;
Set sycs = myNamespace.SyncObjects&lt;br&gt;
For i = 1 To sycs.Count&lt;br&gt;
&amp;nbsp;Set syc = sycs.Item(i)&lt;br&gt;
&amp;nbsp;WScript.StdOut.Writeline "Starting send/receive on " &amp;amp; syc.Name&lt;br&gt;
&amp;nbsp;syc.Start&lt;br&gt;
Next
&lt;/p&gt;
&lt;p&gt;
WScript.StdOut.Writeline "Retreiving unread count"&lt;br&gt;
Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox)
&lt;/p&gt;
&lt;p&gt;
WScript.StdOut.Writeline "There are " &amp;amp; myInbox.UnReadItemCount &amp;amp; " unread
messages"&lt;br&gt;
WScript.Quit myInbox.UnReadItemCount
&lt;/p&gt;
&lt;p&gt;
' Return code == 0 means there is no unread mail. 
&lt;br&gt;
' Return code != 0 means there is that many read mail.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=9f893b36-89aa-4e06-8d03-8ce3944fe883" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,9f893b36-89aa-4e06-8d03-8ce3944fe883.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=847eb8b9-e23f-4bb4-a7d6-45c23f269356</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,847eb8b9-e23f-4bb4-a7d6-45c23f269356.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,847eb8b9-e23f-4bb4-a7d6-45c23f269356.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=847eb8b9-e23f-4bb4-a7d6-45c23f269356</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
More DOS Scripting goodness. This snippet appends some arbitrary location to your
PATH variable, so you can call the executables inside of it.
</p>
        <pre>@ECHO OFF
ECHO %PATH% | FIND /I "C:\Folder1\Folder2\Folder with Spaces\bin\Release"
IF ERRORLEVEL 1 SET PATH=%PATH%;C:\Folder1\Folder2\Folder with Spaces\bin\Release</pre>
        <p>
That, ladies and gentleman, will save you minutes of grief. Isn't that what it's all
about anyway? makes it all worth while.
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=847eb8b9-e23f-4bb4-a7d6-45c23f269356" />
      </body>
      <title>Append Location to Path Environment Variable</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,847eb8b9-e23f-4bb4-a7d6-45c23f269356.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2006/12/18/AppendLocationToPathEnvironmentVariable.aspx</link>
      <pubDate>Mon, 18 Dec 2006 19:43:28 GMT</pubDate>
      <description>&lt;p&gt;
More DOS Scripting goodness. This snippet appends some arbitrary location to your
PATH variable, so you can call the executables inside of it.
&lt;/p&gt;
&lt;pre&gt;@ECHO OFF
ECHO %PATH% | FIND /I "C:\Folder1\Folder2\Folder with Spaces\bin\Release"
IF ERRORLEVEL 1 SET PATH=%PATH%;C:\Folder1\Folder2\Folder with Spaces\bin\Release&lt;/pre&gt;
&lt;p&gt;
That, ladies and gentleman, will save you minutes of grief. Isn't that what it's all
about anyway?&amp;nbsp;makes it all worth while.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=847eb8b9-e23f-4bb4-a7d6-45c23f269356" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,847eb8b9-e23f-4bb4-a7d6-45c23f269356.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=0ba2fcd7-c403-47f5-9cb1-85920f0c4763</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,0ba2fcd7-c403-47f5-9cb1-85920f0c4763.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,0ba2fcd7-c403-47f5-9cb1-85920f0c4763.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0ba2fcd7-c403-47f5-9cb1-85920f0c4763</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Some people (like myself) should learn not to touch a compiler on Monday mornings
(before the third cup of coffee at least)
</p>
        <p>
I don't know why I couldn't remember how to do this, but I feel like a noob.
</p>
        <p>
I was just trying to build a Xml Document in memory with a XmlWriter and a MemoryStream
simple stuff right?
</p>
        <font size="2">
          <p>
          </p>
        </font>
        <font color="#008080" size="2">XmlWriterSettings</font>
        <font size="2"> settings
= </font>
        <font color="#0000ff" size="2">new</font>
        <font size="2">
        </font>
        <font color="#008080" size="2">XmlWriterSettings</font>
        <font size="2">();
<p>
settings.Indent = 
</p></font>
        <font color="#0000ff" size="2">true</font>
        <font size="2">;
<p>
settings.OmitXmlDeclaration = 
</p></font>
        <font color="#0000ff" size="2">false</font>
        <font size="2">; 
<p></p></font>
        <font color="#008080" size="2">MemoryStream</font>
        <font size="2"> strm
= </font>
        <font color="#0000ff" size="2">new</font>
        <font size="2">
        </font>
        <font color="#008080" size="2">MemoryStream</font>
        <font size="2">();
<p></p></font>
        <font color="#0000ff" size="2">using</font>
        <font size="2"> (</font>
        <font color="#008080" size="2">XmlWriter</font>
        <font size="2"> w
= </font>
        <font color="#008080" size="2">XmlWriter</font>
        <font size="2">.Create(strm,
settings)) {</font>
        <p>
          <font size="2">...</font>
        </p>
        <p>
          <font size="2">}
</font>
        </p>
        <p>
Now what if you want to get that back into a string? Say for use in a web-service
query or something. like, I don't know, the SharePoint 2003 Search Web Service.
</p>
        <p>
That conversion back to a string might look something like this.
</p>
        <p>
string s;<br />
System.O.MemoryStream ms;<br />
System.IO.StreamReader sr = new System.IO.StreamReader(ms));<br />
s = sr.ReadToEnd();<br />
sr.Close();<br />
ms.Close(); 
</p>
        <p>
Of course later in the day, I decided to actually download the Research Service SDK,
grab a copy of the QueryPacket Schema I was working against, generated a class against
it with the XSD tool, and subclassed it to make sure I was submitting a valid search
request. All was well with the world again, and I didn't feel so horribly inept for
a Monday morning. Yeah me!
</p>
        <p>
        </p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=0ba2fcd7-c403-47f5-9cb1-85920f0c4763" />
      </body>
      <title>Dont touch a compiler on monday</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,0ba2fcd7-c403-47f5-9cb1-85920f0c4763.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2006/08/07/DontTouchACompilerOnMonday.aspx</link>
      <pubDate>Mon, 07 Aug 2006 16:11:45 GMT</pubDate>
      <description>&lt;p&gt;
Some people (like myself) should learn not to touch a compiler on Monday mornings
(before the third cup of coffee at least)
&lt;/p&gt;
&lt;p&gt;
I don't know why I couldn't remember how to do this, but I feel like a noob.
&lt;/p&gt;
&lt;p&gt;
I was just trying to build a Xml Document in memory with a XmlWriter and a MemoryStream
simple stuff right?
&lt;/p&gt;
&lt;font size=2&gt; 
&lt;p&gt;
&lt;/font&gt;&lt;font color=#008080 size=2&gt;XmlWriterSettings&lt;/font&gt;&lt;font size=2&gt; settings = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;XmlWriterSettings&lt;/font&gt;&lt;font size=2&gt;();&gt;
&lt;p&gt;
settings.Indent = 
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;true&lt;/font&gt;&lt;font size=2&gt;;&gt;
&lt;p&gt;
settings.OmitXmlDeclaration = 
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;false&lt;/font&gt;&lt;font size=2&gt;; &gt;
&lt;p&gt;
&lt;/font&gt;&lt;font color=#008080 size=2&gt;MemoryStream&lt;/font&gt;&lt;font size=2&gt; strm = &lt;/font&gt;&lt;font color=#0000ff size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#008080 size=2&gt;MemoryStream&lt;/font&gt;&lt;font size=2&gt;();&gt;
&lt;p&gt;
&lt;/font&gt;&lt;font color=#0000ff size=2&gt;using&lt;/font&gt;&lt;font size=2&gt; (&lt;/font&gt;&lt;font color=#008080 size=2&gt;XmlWriter&lt;/font&gt;&lt;font size=2&gt; w
= &lt;/font&gt;&lt;font color=#008080 size=2&gt;XmlWriter&lt;/font&gt;&lt;font size=2&gt;.Create(strm, settings))
{&lt;/font&gt;&gt;
&lt;p&gt;
&lt;font size=2&gt;...&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=2&gt;}
&lt;/p&gt;
&gt; 
&lt;p&gt;
Now what if you want to get that back into a string? Say for use in a web-service
query or something. like, I don't know, the SharePoint 2003 Search Web Service.
&lt;/p&gt;
&lt;p&gt;
That conversion back to a string might look something like this.
&lt;/p&gt;
&lt;p&gt;
string s;&lt;br&gt;
System.O.MemoryStream ms;&lt;br&gt;
System.IO.StreamReader&amp;nbsp;sr = new System.IO.StreamReader(ms));&lt;br&gt;
s&amp;nbsp;= sr.ReadToEnd();&lt;br&gt;
sr.Close();&lt;br&gt;
ms.Close(); 
&lt;/p&gt;
&lt;p&gt;
Of course later in the day, I decided to actually download the Research Service SDK,
grab a copy of the QueryPacket Schema I was working against, generated a class against
it with the XSD tool, and subclassed it to make sure I was submitting a valid search
request. All was well with the world again, and I didn't feel so horribly inept for
a Monday morning. Yeah me!
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=0ba2fcd7-c403-47f5-9cb1-85920f0c4763" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,0ba2fcd7-c403-47f5-9cb1-85920f0c4763.aspx</comments>
      <category>All things Microsoft</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=357469ed-8e68-4567-ab11-685da594c8f1</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,357469ed-8e68-4567-ab11-685da594c8f1.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,357469ed-8e68-4567-ab11-685da594c8f1.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=357469ed-8e68-4567-ab11-685da594c8f1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h2>Using a text file to hold sequential numbers
</h2>
        <p>
This method is more useful in some situations. The biggest advantage is that the sequential
number is no longer tied to a particular machine - it can be stored on a common server,
or even a thumb drive. Disadvantages include difficulty in keeping the file from being
modified simultaneously by two users, or of the file being more easily deleted or
modified. This function will return the next sequential number:
</p>
        <pre>
Public Function GetNextSeqNumber(Optional sFileName As String, Optional nSeqNumber As Long = -1) As Long            
	Const sDEFAULT_PATH As String = "&lt;your path here&gt;"            
	Const sDEFAULT_FNAME As String = "defaultseq.txt"            
	Dim nFileNumber As Long                    
	nFileNumber = FreeFile            
	If sFileName = "" Then sFileName = sDEFAULT_FNAME                
		If InStr(sFileName, Application.PathSeparator) = 0 Then _                       
			sFileName = sDEFAULT_PATH &amp; Application.PathSeparator &amp; sFileName            

	If nSeqNumber = -1&amp; Then                    
		If Dir(sFileName) &lt;&gt; "" Then                            
			Open sFileName For Input As nFileNumber                            
			Input #nFileNumber, nSeqNumber
			nSeqNumber = nSeqNumber + 1
			Close nFileNumber                    
		Else                            
			nSeqNumber = 1
		End If            
	End If                        

	On Error GoTo PathError                        
		Open sFileName For Output As nFileNumber                        

	On Error GoTo 0                        
		Print #nFileNumber, nSeqNumber                        
		Close nFileNumber            
		NextSeqNumber = nSeqNumber            
		Exit Function    

	PathError:            
		NextSeqNumber = -1
End Function
</pre>
        <p>
If you provide a full path in sFileName, that's where the file will be stored. If
not, the file will be stored in whatever default directory you specify. You can set
the sequential number by providing a value for nSeqNumber.
</p>
        <p>
Thus, if I'm only using one sequence I can use
</p>
        <pre>
Public Sub Workbook_Open()            
	ThisWorkbook.Sheets(1).Range("B2").Value = GetNextSeqNumber    
End Sub
</pre>
        <p>
to return the next sequence number. If I'm using multiple sequences, I include the
filename (with path, if the text file is not in the default path). 
</p>
        <pre>
Public Sub NewClientInvoice()            
	This.Workbook.Sheets(1).Range("B2").Value = GetNextSeqNumber("Client1.txt")    
End Sub
</pre>
        <p>
And if I want to start a new sequence, beginning at, say, 1001, include that number
in the function call. If the client name were in cell B4: 
</p>
        <pre>
Public Sub SetUpNewClient()
	With ThisWorkbook.Sheets(1)        
		.Range("B2").Value = GetNextSeqNumber(.Range("B4").Value &amp; ".txt", 1001)            
	End With    
End Sub
</pre>
Original article credit to: <a href="http://www.mcgimpsey.com/excel/udfs/sequentialnums.html">http://www.mcgimpsey.com/excel/udfs/sequentialnums.html</a><br />
Excel is a licensed product of Microsoft Corporation <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=357469ed-8e68-4567-ab11-685da594c8f1" /></body>
      <title>Using a text file to hold sequential numbers in Excel</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,357469ed-8e68-4567-ab11-685da594c8f1.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2005/01/10/UsingATextFileToHoldSequentialNumbersInExcel.aspx</link>
      <pubDate>Mon, 10 Jan 2005 16:46:52 GMT</pubDate>
      <description>&lt;h2&gt;Using a text file to hold sequential numbers
&lt;/h2&gt;
&lt;p&gt;
This method is more useful in some situations. The biggest advantage is that the sequential
number is no longer tied to a particular machine - it can be stored on a common server,
or even a thumb drive. Disadvantages include difficulty in keeping the file from being
modified simultaneously by two users, or of the file being more easily deleted or
modified. This function will return the next sequential number:
&lt;/p&gt;
&lt;pre&gt;
Public Function GetNextSeqNumber(Optional sFileName As String, Optional nSeqNumber As Long = -1) As Long            
	Const sDEFAULT_PATH As String = "&amp;lt;your path here&amp;gt;"            
	Const sDEFAULT_FNAME As String = "defaultseq.txt"            
	Dim nFileNumber As Long                    
	nFileNumber = FreeFile            
	If sFileName = "" Then sFileName = sDEFAULT_FNAME                
		If InStr(sFileName, Application.PathSeparator) = 0 Then _                       
			sFileName = sDEFAULT_PATH &amp;amp; Application.PathSeparator &amp;amp; sFileName            

	If nSeqNumber = -1&amp;amp; Then                    
		If Dir(sFileName) &amp;lt;&amp;gt; "" Then                            
			Open sFileName For Input As nFileNumber                            
			Input #nFileNumber, nSeqNumber
			nSeqNumber = nSeqNumber + 1
			Close nFileNumber                    
		Else                            
			nSeqNumber = 1
		End If            
	End If                        

	On Error GoTo PathError                        
		Open sFileName For Output As nFileNumber                        

	On Error GoTo 0                        
		Print #nFileNumber, nSeqNumber                        
		Close nFileNumber            
		NextSeqNumber = nSeqNumber            
		Exit Function    

	PathError:            
		NextSeqNumber = -1
End Function
&lt;/pre&gt;
&lt;p&gt;
If you provide a full path in sFileName, that's where the file will be stored. If
not, the file will be stored in whatever default directory you specify. You can set
the sequential number by providing a value for nSeqNumber.
&lt;/p&gt;
&lt;p&gt;
Thus, if I'm only using one sequence I can use
&lt;/p&gt;
&lt;pre&gt;
Public Sub Workbook_Open()            
	ThisWorkbook.Sheets(1).Range("B2").Value = GetNextSeqNumber    
End Sub
&lt;/pre&gt;
&lt;p&gt;
to return the next sequence number. If I'm using multiple sequences, I include the
filename (with path, if the text file is not in the default path). 
&lt;/p&gt;
&lt;pre&gt;
Public Sub NewClientInvoice()            
	This.Workbook.Sheets(1).Range("B2").Value = GetNextSeqNumber("Client1.txt")    
End Sub
&lt;/pre&gt;
&lt;p&gt;
And if I want to start a new sequence, beginning at, say, 1001, include that number
in the function call. If the client name were in cell B4: 
&lt;/p&gt;
&lt;pre&gt;
Public Sub SetUpNewClient()
	With ThisWorkbook.Sheets(1)        
		.Range("B2").Value = GetNextSeqNumber(.Range("B4").Value &amp;amp; ".txt", 1001)            
	End With    
End Sub
&lt;/pre&gt;
Original article credit to: &lt;a href="http://www.mcgimpsey.com/excel/udfs/sequentialnums.html"&gt;http://www.mcgimpsey.com/excel/udfs/sequentialnums.html&lt;/a&gt;
&lt;br /&gt;
Excel is a licensed product of Microsoft Corporation &lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=357469ed-8e68-4567-ab11-685da594c8f1" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,357469ed-8e68-4567-ab11-685da594c8f1.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=6a925e1d-1c64-4a24-b959-f04602994164</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,6a925e1d-1c64-4a24-b959-f04602994164.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,6a925e1d-1c64-4a24-b959-f04602994164.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6a925e1d-1c64-4a24-b959-f04602994164</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img alt="" hspace="5" src="http://www.jeremysimmons.net/blog/microsoftcake.JPG" align="right" vspace="5" border="0" />I
was looking around the Microsoft Windodws Media Center Edition website and they had
this great rolling banner ad.
</p>
        <p>
I'm not sure where they think there's anywhere near the equivalency of the company
to fruitcake, but it made me smile just the same.
</p>
        <p>
Speaking of which, I my Home Theater PC is up and running (90%) now and I have to
say it's the coolest gadget we have in the house. The only thing that isn't working
yet is the VFD, but I suspect that it's bad for some reason. So. We'll just have to
trouble shoot that until we figure it out out, now won't we? 
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=6a925e1d-1c64-4a24-b959-f04602994164" />
      </body>
      <title>Microsoft ?= Fruitcake</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,6a925e1d-1c64-4a24-b959-f04602994164.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2004/12/09/MicrosoftFruitcake.aspx</link>
      <pubDate>Thu, 09 Dec 2004 16:25:28 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img alt="" hspace=5 src="http://www.jeremysimmons.net/blog/microsoftcake.JPG" align=right vspace=5 border=0&gt;I
was looking around the Microsoft Windodws Media Center Edition website and they had
this great rolling banner ad.
&lt;/p&gt;
&lt;p&gt;
I'm not sure where they think there's anywhere near the equivalency of the company
to fruitcake, but it made me smile just the same.
&lt;/p&gt;
&lt;p&gt;
Speaking of which, I my Home Theater PC is up and running (90%) now and I have to
say it's the coolest gadget we have in the house. The only thing that isn't working
yet is the VFD, but I suspect that it's bad for some reason. So. We'll just have to
trouble shoot that until we figure it out out, now won't we?&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=6a925e1d-1c64-4a24-b959-f04602994164" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,6a925e1d-1c64-4a24-b959-f04602994164.aspx</comments>
      <category>All things Microsoft</category>
    </item>
    <item>
      <trackback:ping>http://www.jeremysimmons.net/blog/Trackback.aspx?guid=7aaa0cc6-f230-4d25-b146-1e1182c9792b</trackback:ping>
      <pingback:server>http://www.jeremysimmons.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.jeremysimmons.net/blog/PermaLink,guid,7aaa0cc6-f230-4d25-b146-1e1182c9792b.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.jeremysimmons.net/blog/CommentView,guid,7aaa0cc6-f230-4d25-b146-1e1182c9792b.aspx</wfw:comment>
      <wfw:commentRss>http://www.jeremysimmons.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7aaa0cc6-f230-4d25-b146-1e1182c9792b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font color="#000000">
            <span>COVER YOUR SECURITY HOLES! It's quick, it's painless,
and should be a standard procedure for all production apps.</span>
          </font>
        </p>
        <font color="#000000">
          <span>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <h4>Global.asax code sample (Visual Basic .NET)
</h4>
            </span>
            <p>
              <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">&lt;script
language=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"vb"</span> runat=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"server"</span>&gt;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span> Application_BeginRequest(Sender <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Object</span>,
E <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">as</span> EventArgs)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> (Request.Path.IndexOf(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">chr</span>(92))
&gt;= 0 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">OR</span> _<br />
System.IO.Path.GetFullPath(Request.PhysicalPath) &lt;&gt; Request.PhysicalPath) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">then</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> HttpException(404, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Not
Found"</span>)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span><br />
&lt;/script&gt;</span>
            </p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <h4>Global.asax code sample ( C#)
</h4>
              <p>
                <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">&lt;script
language=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"C#"</span> runat=<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"server"</span>&gt;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Application_BeginRequest(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> source,
EventArgs e) {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (Request.Path.IndexOf('\\')
&gt;= 0 ||<br />
System.IO.Path.GetFullPath(Request.PhysicalPath) !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Request.PhysicalPath)
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> HttpException(404, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"not
found"</span>);<br />
}<br />
}<br />
&lt;/script&gt;<br /></span>
              </p>
            </span>
            <p>
              <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
                <br />
 
</span>
            </p>
          </span>
        </font>
        <p>
          <font color="#000000">
            <span>On with the blog.</span>
          </font>
        </p>
        <p>
          <font color="#000000">
            <span>I was reading my daily email and ran accross a new alert.
Apparantly on 10/6/2004 Microsoft released KB Article 887459. This article can be
read here <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;887459">http://support.microsoft.com/default.aspx?scid=kb;EN-US;887459</a> </span>
          </font>
          <font color="#000000">
            <span>The
site that I visit to find out about these is <a href="http://kbalertz.com/">http://kbalertz.com</a>.
Great site, they have a free email letter. Sign up if you're any kind of a respectable
Microsoft geek.</span>
          </font>
        </p>
        <p>
          <font color="#000000">
            <span>So, in this website, on the feedback someone says, “Well,
we have URLScan installed. Aren't we already covered“ </span>
          </font>
        </p>
        <p>
          <font color="#000000">
            <span>
            </span>
          </font>
          <font color="#000000">
            <span>Yes, my friend,
you are covered from a canononical attack if you use the default install of URLScan,
and it hasn't been tampered with, and you can ensure some sysadmin hasn't uninstalled
it, or some developer who is too lazy to write code that is kosher with that kind
of tool. Lets not forget, gasp, our customers may not have this installed.</span>
          </font>
        </p>
        <p>
          <font color="#000000">
            <span>If you read the documentation for URLScan here  </span>
          </font>
          <font color="#000000">
            <span>
              <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HT_URLScan.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HT_URLScan.asp</a> You'll
find the following info</span>
          </font>
        </p>
        <ul>
          <li>
            <font color="#000000">
              <span>URLScan blocks requests that contain potentially harmful
characters, for example, characters that have been used to exploit vulnerabilities
in the past such as "." used for directory traversal. It is not recommended that project
paths contain the "." character. If you must allow this, you need to set AllowDotInPath=1
in URLScan.ini. </span>
            </font>
          </li>
        </ul>
        <p>
          <font color="#000000">
            <span>It's very clear that URLScan does do the same 'thing'
(blocking a period to avoid canononical traversal) only in the sense that it accomplishes
it as an end result. It does not do provide a total solution for all vectors of attack.
The problem is that if you deploy a webapp to a customer's box, you cannot ensure
that they have (or will have) Urlscan installed. If you the vendor do not take steps
to make sure that kind of functionality is provided within the app, you're going to
loose one (if not many more) customers.</span> This kind of common sense is not something
they put in KB articles, and is reserved mostly for blogs. Sigh. Maybe someone will
read this and take it to heart.</font>
        </p>
        <p>
          <font color="#000000">Update,</font>
        </p>
        <p>
          <font color="#000000">I pulled this information from Scott Hanselman's blog <a href="http://www.hanselman.com/blog/PermaLink.aspx?guid=78159d3b-40f2-45d0-93ad-2718274cbccb">http://www.hanselman.com/blog/PermaLink.aspx?guid=78159d3b-40f2-45d0-93ad-2718274cbccb</a></font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>1) Updated </em>
            <a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;url=http%3a%2f%2fwww.microsoft.com%2fsecurity%2fincident%2faspnet.mspx">
              <em>http://www.microsoft.com/security/incident/aspnet.mspx</em>
            </a>
            <em> with
new information about the reported vulnerability.  This should help clear up
some of the confusion we've seen about what is affected by this.  To be super
clear, all ASP.NET applications, on ALL OS's should follow the guidance provided.</em>
          </p>
          <p>
            <em>2) A new HTTP Module mitigation best practice.  This is in the form
of an MSI installer that will help protect all ASP.NET applications on a Web server. 
This MSI installer will place a binary into the GAC and update the machine.config
file for ASP.NET.  You can find download information at </em>
            <a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;url=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3fFamilyID%3dda77b852-dfa0-4631-aaf9-8bcc6c743026%26displaylang%3den">
              <em>http://www.microsoft.com/downloads/details.aspx?FamilyID=da77b852-dfa0-4631-aaf9-8bcc6c743026&amp;displaylang=en</em>
            </a>
          </p>
          <p>
            <em>You can also download the MSI directly at </em>
            <a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;url=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f4%2f6%2f1%2f461433d5-cbac-4721-85cb-c5a514fd0049%2fVPModule.msi">
              <em>http://download.microsoft.com/download/4/6/1/461433d5-cbac-4721-85cb-c5a514fd0049/VPModule.msi</em>
            </a>
          </p>
          <p>
            <em>3) Detailed guidance about the HTTP Module, how the MSI works, and how to deploy
it.  You can find this KB Article at </em>
            <a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;url=http%3a%2f%2fsupport.microsoft.com%2f%3fkbid%3d887289">
              <em>http://support.microsoft.com/?kbid=887289</em>
            </a>
            <br />
          </p>
        </blockquote>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=7aaa0cc6-f230-4d25-b146-1e1182c9792b" />
      </body>
      <title>Making your Asp.Net Applications safe from conononical attacks</title>
      <guid isPermaLink="false">http://www.jeremysimmons.net/blog/PermaLink,guid,7aaa0cc6-f230-4d25-b146-1e1182c9792b.aspx</guid>
      <link>http://www.jeremysimmons.net/blog/2004/10/08/MakingYourAspNetApplicationsSafeFromConononicalAttacks.aspx</link>
      <pubDate>Fri, 08 Oct 2004 13:46:03 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;COVER YOUR SECURITY HOLES! It's quick, it's painless, and
should be a standard procedure for all production apps.&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;font color=#000000&gt;&lt;span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;h4&gt;Global.asax code sample (Visual Basic .NET)
&lt;/h4&gt;
&lt;/span&gt; 
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;lt;script
language=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"vb"&lt;/span&gt; runat=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"server"&lt;/span&gt;&amp;gt;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Sub&lt;/span&gt; Application_BeginRequest(Sender &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Object&lt;/span&gt;,
E &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;as&lt;/span&gt; EventArgs)&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;If&lt;/span&gt; (Request.Path.IndexOf(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;chr&lt;/span&gt;(92))
&amp;gt;= 0 &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;OR&lt;/span&gt; _&lt;br&gt;
System.IO.Path.GetFullPath(Request.PhysicalPath) &amp;lt;&amp;gt; Request.PhysicalPath) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;then&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;New&lt;/span&gt; HttpException(404, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Not
Found"&lt;/span&gt;)&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;End&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;If&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;End&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Sub&lt;/span&gt;
&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt; 
&lt;h4&gt;Global.asax code sample ( C#)
&lt;/h4&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;lt;script
language=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"C#"&lt;/span&gt; runat=&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"server"&lt;/span&gt;&amp;gt;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Application_BeginRequest(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; source,
EventArgs e) {&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (Request.Path.IndexOf('\\')
&amp;gt;= 0 ||&lt;br&gt;
System.IO.Path.GetFullPath(Request.PhysicalPath) !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Request.PhysicalPath)
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; HttpException(404, &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"not
found"&lt;/span&gt;);&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;/span&gt; 
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
&lt;br&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;/span&gt;&gt;&lt;/font&gt; 
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;On with the blog.&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;I was reading my daily email and ran accross a new alert.
Apparantly on 10/6/2004 Microsoft released KB Article 887459. This article can be
read here &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;887459"&gt;http://support.microsoft.com/default.aspx?scid=kb;EN-US;887459&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;font color=#000000&gt;&lt;span&gt;The
site that I visit to find out about these is &lt;a href="http://kbalertz.com/"&gt;http://kbalertz.com&lt;/a&gt;.
Great site, they have a free email letter. Sign up if you're any kind of a respectable
Microsoft geek.&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;So, in this website, on the feedback someone says, &amp;#8220;Well,
we have URLScan installed. Aren't we already covered&amp;#8220; &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font color=#000000&gt;&lt;span&gt;Yes, my friend,
you are covered from a canononical attack if you use the default install of URLScan,
and it hasn't been tampered with, and you can ensure some sysadmin hasn't uninstalled
it, or some developer who is too lazy to write code that is kosher with that kind
of tool. Lets not forget, gasp, our customers may not have this installed.&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;If you read the documentation for URLScan here&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;font color=#000000&gt;&lt;span&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HT_URLScan.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/HT_URLScan.asp&lt;/a&gt;&amp;nbsp;You'll
find the following info&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;font color=#000000&gt;&lt;span&gt;URLScan blocks requests that contain potentially harmful
characters, for example, characters that have been used to exploit vulnerabilities
in the past such as "." used for directory traversal. It is not recommended that project
paths contain the "." character. If you must allow this, you need to set AllowDotInPath=1
in URLScan.ini.&amp;nbsp;&lt;/span&gt;&lt;/font&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font color=#000000&gt;&lt;span&gt;It's very clear that&amp;nbsp;URLScan does do the same 'thing'
(blocking a period to avoid canononical traversal) only in the sense that it accomplishes
it as an end result. It does not do provide a total solution for all vectors of attack.
The problem is that if you deploy a webapp to a customer's box, you cannot ensure
that they have (or will have) Urlscan installed. If you the vendor do not take steps
to make sure that kind of functionality is provided within the app, you're going to
loose one (if not many more) customers.&lt;/span&gt; This kind of common sense is not something
they put in KB articles, and is reserved mostly for blogs. Sigh. Maybe someone will
read this and take it to heart.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;Update,&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;I pulled this information from Scott Hanselman's blog &lt;a href="http://www.hanselman.com/blog/PermaLink.aspx?guid=78159d3b-40f2-45d0-93ad-2718274cbccb"&gt;http://www.hanselman.com/blog/PermaLink.aspx?guid=78159d3b-40f2-45d0-93ad-2718274cbccb&lt;/a&gt;&lt;/font&gt; 
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
&lt;em&gt;1) Updated &lt;/em&gt;&lt;a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;amp;url=http%3a%2f%2fwww.microsoft.com%2fsecurity%2fincident%2faspnet.mspx"&gt;&lt;em&gt;http://www.microsoft.com/security/incident/aspnet.mspx&lt;/em&gt;&lt;/a&gt;&lt;em&gt; with
new information about the reported vulnerability.&amp;nbsp; This should help clear up
some of the confusion we've seen about what is affected by this.&amp;nbsp; To be super
clear, all ASP.NET applications, on ALL OS's should follow the guidance provided.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;2)&amp;nbsp;A new HTTP Module mitigation best practice.&amp;nbsp; This is in the form
of an MSI installer that will help protect all ASP.NET applications on a Web server.&amp;nbsp;
This MSI installer will place a binary into the GAC and update the machine.config
file for ASP.NET.&amp;nbsp; You can find download information at &lt;/em&gt;&lt;a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;amp;url=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3fFamilyID%3dda77b852-dfa0-4631-aaf9-8bcc6c743026%26displaylang%3den"&gt;&lt;em&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=da77b852-dfa0-4631-aaf9-8bcc6c743026&amp;amp;displaylang=en&lt;/em&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;You can also download the MSI directly at &lt;/em&gt;&lt;a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;amp;url=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f4%2f6%2f1%2f461433d5-cbac-4721-85cb-c5a514fd0049%2fVPModule.msi"&gt;&lt;em&gt;http://download.microsoft.com/download/4/6/1/461433d5-cbac-4721-85cb-c5a514fd0049/VPModule.msi&lt;/em&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;3) Detailed guidance about the HTTP Module, how the MSI works, and how to deploy
it.&amp;nbsp; You can find this KB Article at &lt;/em&gt;&lt;a href="http://www.hanselman.com/blog/ct.ashx?id=78159d3b-40f2-45d0-93ad-2718274cbccb&amp;amp;url=http%3a%2f%2fsupport.microsoft.com%2f%3fkbid%3d887289"&gt;&lt;em&gt;http://support.microsoft.com/?kbid=887289&lt;/em&gt;&lt;/a&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.jeremysimmons.net/blog/aggbug.ashx?id=7aaa0cc6-f230-4d25-b146-1e1182c9792b" /&gt;</description>
      <comments>http://www.jeremysimmons.net/blog/CommentView,guid,7aaa0cc6-f230-4d25-b146-1e1182c9792b.aspx</comments>
      <category>All things Microsoft</category>
      <category>ASP.Net</category>
    </item>
  </channel>
</rss>