<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>dotNetTips.com</title>
  <link rel="alternate" type="text/html" href="http://dotnettips.com/" />
  <link rel="self" href="http://dotnettips.com/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-05-12T12:59:35.9196250-07:00</updated>
  <author>
    <name>David McCarter</name>
  </author>
  <subtitle>Real World Tips &amp; Tricks</subtitle>
  <id>http://dotnettips.com/</id>
  <generator uri="http://www.dasblog.net" version="1.9.7174.0">DasBlog</generator>
  <entry>
    <title>ASP.NET Codeplex Site</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/05/12/ASPNETCodeplexSite.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,4714dcd0-2664-4e23-9daf-436adfec59a6.aspx</id>
    <published>2008-05-12T12:59:35.9196250-07:00</published>
    <updated>2008-05-12T12:59:35.9196250-07:00</updated>
    <category term="ASP.NET" label="ASP.NET" scheme="http://dotnettips.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Link" label="Link" scheme="http://dotnettips.com/CategoryView,category,Link.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This project gives you access to the code for upcoming releases that the Microsoft
ASP.NET team is working on. The project gives you a look at the design and lets you
have a voice in it.
</p>
        <p>
          <a href="http://codeplex.com/aspnet">http://codeplex.com/aspnet</a>
        </p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=4714dcd0-2664-4e23-9daf-436adfec59a6" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Learn .NET from dotNetDave</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/04/14/LearnNETFromDotNetDave.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,955ff482-211e-438d-b264-4d760d431749.aspx</id>
    <published>2008-04-14T09:34:27.4280000-07:00</published>
    <updated>2008-03-26T09:34:27.4285000-07:00</updated>
    <category term=".NET" label=".NET" scheme="http://dotnettips.com/CategoryView,category,.NET.aspx" />
    <category term="C#" label="C#" scheme="http://dotnettips.com/CategoryView,category,C%23.aspx" />
    <category term="dotNetDave" label="dotNetDave" scheme="http://dotnettips.com/CategoryView,category,dotNetDave.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://dotnettips.com/CategoryView,category,VB.NET.aspx" />
    <content type="html">If you live in the San Diego area, dotNetDave (a.k.a. David McCarter) will be teaching a 6 week &lt;b&gt;Fundamentals
of the .NET Framework&lt;/b&gt; course at the University of California, San Diego Extension
beginning on Thursday 5/14/2008 from 5:30pm to 10:00pm. For more information and to
enroll, please &lt;a href="ct.ashx?id=0894c648-8300-42c9-b332-031a3c017eeb&amp;amp;url=http%3a%2f%2fdotnetdaveclasses.notlong.com%2f" target="_blank" ?=""&gt;&lt;strong&gt;&lt;font color="#005bba"&gt;click
here&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=955ff482-211e-438d-b264-4d760d431749" /&gt;</content>
  </entry>
  <entry>
    <title>Turn Off Web Service Logging When Using WSE</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/04/10/TurnOffWebServiceLoggingWhenUsingWSE.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,4ab7e839-7700-48f6-9f67-7a3586109b3a.aspx</id>
    <published>2008-04-10T12:41:24.7597820-07:00</published>
    <updated>2008-04-10T12:41:24.7597820-07:00</updated>
    <category term="Web Services" label="Web Services" scheme="http://dotnettips.com/CategoryView,category,Web%2BServices.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the features I use often with the Microsoft Web Service Enhancements (WSE)
is logging. It's a great feature where it logs everything coming in and out of a web
service. When someone calls me with issues, the first thing I do is turn this on in
the web.config and watch the data coming and going. The data is stored in two
different xml files. One for incoming calls and one for responses. 
</p>
        <p>
The problem I just ran into is that I got a call that stated web service calls that
were taking about 1 second or less were now taking 20 seconds or even timing
out. After working on the issue off and on for two days I discovered that these two
WSE log files have grown to 59MB+ because I forgot to turn off logging the last time
there was an issue! Once I turned off logging this issue went away.
</p>
        <p>
One symptom that we noticed that made us go down the wrong direction at first was
that the w3wp.exe in Task Manager would eat a lot of memory during those 20 seconds
and spike the CPU usage up to 99%! When we Googled this, we found lots similar
issues, but none relating to the xml log files generated by WSE. We wasted a lot of
time on this.
</p>
        <p>
I hope this helps anyone else that uses logging in WSE.
</p>
        <p>
          <strong>
            <font color="#006400">Tip By: David McCarter</font>
          </strong>
        </p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=4ab7e839-7700-48f6-9f67-7a3586109b3a" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Get a Free Copy of Visual Studio 2008</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/03/18/GetAFreeCopyOfVisualStudio2008.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,40029720-dfb1-4a7f-8a40-22643ce4da7b.aspx</id>
    <published>2008-03-18T13:32:21.6610000-07:00</published>
    <updated>2008-03-18T13:32:21.6610000-07:00</updated>
    <category term="Link" label="Link" scheme="http://dotnettips.com/CategoryView,category,Link.aspx" />
    <category term="News" label="News" scheme="http://dotnettips.com/CategoryView,category,News.aspx" />
    <category term="VS.NET" label="VS.NET" scheme="http://dotnettips.com/CategoryView,category,VS.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are a student at a university, you can get a free copy of Visual Studio 2008
Professional and other Microsoft software. Got to this link: <a href="https://downloads.channel8.msdn.com/Products/Visual_Studio_2008.aspx">https://downloads.channel8.msdn.com/Products/Visual_Studio_2008.aspx</a></p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=40029720-dfb1-4a7f-8a40-22643ce4da7b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ASP.NET 3.5 Extensions Preview</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/03/10/ASPNET35ExtensionsPreview.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,ecf9c0fe-b86a-45cb-b338-ffef43ff9ff5.aspx</id>
    <published>2008-03-10T09:38:11.6247500-07:00</published>
    <updated>2008-03-10T09:38:11.6247500-07:00</updated>
    <category term="ADO.NET" label="ADO.NET" scheme="http://dotnettips.com/CategoryView,category,ADO.NET.aspx" />
    <category term="AJAX" label="AJAX" scheme="http://dotnettips.com/CategoryView,category,AJAX.aspx" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://dotnettips.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Link" label="Link" scheme="http://dotnettips.com/CategoryView,category,Link.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The ASP.NET 3.5 Extensions Preview is a preview of new features being added to ASP.NET
3.5 and ADO.NET.
</p>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=A9C6BC06-B894-4B11-8300-35BD2F8FC908&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=A9C6BC06-B894-4B11-8300-35BD2F8FC908&amp;displaylang=en</a>
        </p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=ecf9c0fe-b86a-45cb-b338-ffef43ff9ff5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Microsoft SQL Server Compact 3.5 Books Online and Samples</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/03/10/MicrosoftSQLServerCompact35BooksOnlineAndSamples.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,b44cf537-7524-4a37-a48f-a69a6629b17e.aspx</id>
    <published>2008-03-10T09:31:15.0466250-07:00</published>
    <updated>2008-03-10T09:31:15.0466250-07:00</updated>
    <category term="ADO.NET" label="ADO.NET" scheme="http://dotnettips.com/CategoryView,category,ADO.NET.aspx" />
    <category term="Compact Framework" label="Compact Framework" scheme="http://dotnettips.com/CategoryView,category,Compact%2BFramework.aspx" />
    <category term="Link" label="Link" scheme="http://dotnettips.com/CategoryView,category,Link.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div id="quickDescription">SQL Server Compact 3.5 is a small footprint in-process
database engine that allows developers to build robust applications for Windows Desktops
and Mobile Devices. This download contains the Books Online and Samples for SQL Server
Compact 3.5
</div>
        <div> 
</div>
        <div>
          <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=1FF0529A-EB1F-4044-B4B7-40B00710F7B7&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=1FF0529A-EB1F-4044-B4B7-40B00710F7B7&amp;displaylang=en</a>
        </div>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=b44cf537-7524-4a37-a48f-a69a6629b17e" />
      </div>
    </content>
  </entry>
  <entry>
    <title>SQL Server CE and Typed Datasets</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/03/06/SQLServerCEAndTypedDatasets.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,1659268b-fe2e-4faa-8ead-ba0f4afd5043.aspx</id>
    <published>2008-03-06T15:11:16.9400000-08:00</published>
    <updated>2008-03-06T16:12:27.7374600-08:00</updated>
    <category term="ADO.NET" label="ADO.NET" scheme="http://dotnettips.com/CategoryView,category,ADO.NET.aspx" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://dotnettips.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Compact Framework" label="Compact Framework" scheme="http://dotnettips.com/CategoryView,category,Compact%2BFramework.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://dotnettips.com/CategoryView,category,SQL%2BServer.aspx" />
    <category term="LINQ" label="LINQ" scheme="http://dotnettips.com/CategoryView,category,LINQ.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I found out the hard way in the last two days that an SQL Server CE database does
not work properly when creating a typed Dataset with a ASP.NET 3.5 application. Sure,
you can create one in the IDE, but the code-on-the-fly will not be generated therefor
you can't use it in your code. Actually causes an error if you try to build.
</p>
        <p>
Rec'd an confirmation from Microsoft today that they did not implement this for ASP.NET.
Just wanted to warn you so you don't waste an hour plus like I did. If you still want
to use SQL Server CE and typed DataSets in ASP.NET you will need to create a separate
assembly (which should be done anyway). Oh, won't work with LINQ either.
</p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=1659268b-fe2e-4faa-8ead-ba0f4afd5043" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Installing VS 2008 Crystal Reports Runtime on a Server</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/03/03/InstallingVS2008CrystalReportsRuntimeOnAServer.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,f9f0e287-f95e-4082-bb2f-103f1db69176.aspx</id>
    <published>2008-03-03T10:51:05.8486250-08:00</published>
    <updated>2008-03-03T10:51:05.8486250-08:00</updated>
    <category term="ASP.NET" label="ASP.NET" scheme="http://dotnettips.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Reporting" label="Reporting" scheme="http://dotnettips.com/CategoryView,category,Reporting.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I needed to update a program and when I brought it up in VS 2008, it changed the version
of Crystal Reports to 10.5.3700. This presented a challenge to get the required Crystal
files onto the production server. Of course using the VS web publish feature does
not do this even though I wish it did. So I went to the Business Objects site (makers
of Crystal Reports) to search for an install. I first download the version for 2008...
made sense to me, but it actually turned out to be version 12. 
</p>
        <p>
Then I tried the download for CrystalReports 2008 ClickOnce Package for Visual Studio
2005 since it said it was version 10. Unfortuneatly it did not say what minor version it
was. This turned into a headache because it kept asking me for a product ID before
the install would continue. I followed the instructions and got the number from VS
2008 and that did not work. Even spend time registering Crystal with Business Objects
and that did not work either. I tried to create a support case on their web site and
that was not even working!
</p>
        <p>
After many hours of frustration, I did a search of my hard drive of ANY file that
started with "Crystal" and I finally found it! The installs are located in this directory:
</p>
        <pre>C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5</pre>
        <p>
The files are either CRRedist2008_x86.msi or CRRedist2008_x64.msi. I installed them
on the server and everything worked fine.
</p>
        <p>
I hope this might save you from all the the wasted time I went through. Another reason
why I love Microsoft Reporting Services!!!
</p>
        <p>
          <strong>
            <font color="#006400">Tip Submitted By: David McCarter</font>
          </strong>
        </p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=f9f0e287-f95e-4082-bb2f-103f1db69176" />
      </div>
    </content>
  </entry>
  <entry>
    <title>dotNetTips.com Utility Release 1</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/02/27/dotNetTipscomUtilityRelease1.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,9949153a-923f-4c8d-8716-c14acaf70fc4.aspx</id>
    <published>2008-02-27T12:00:52.7470000-08:00</published>
    <updated>2008-02-28T12:00:52.7474517-08:00</updated>
    <category term=".NET" label=".NET" scheme="http://dotnettips.com/CategoryView,category,.NET.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://dotnettips.com/CategoryView,category,VB.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I released the first public version of my dotNetTips.com Utility assembly. This
is an open source .NET 2.0 utility assembly that contains useful common code
that anyone can use in just about any project. Helper classes include Active Directory,
Validation, IIS, File IO, Security, Computer Info, Web, XML and more. Other classes
include a better TextBox and ComboBox, sending e-mail, encryption and more. 
</p>
        <p>
To download go to:
</p>
        <p>
          <a href="http://www.codeplex.com/dotNetTipsUtility">http://www.codeplex.com/dotNetTipsUtility</a>
        </p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=9949153a-923f-4c8d-8716-c14acaf70fc4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>January 2008 SoCal Code Camp</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/01/19/January2008SoCalCodeCamp.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,7f25dd65-6c26-4a00-bdda-936245ca9722.aspx</id>
    <published>2008-01-18T20:25:26.8080000-08:00</published>
    <updated>2008-01-30T14:01:54.5870000-08:00</updated>
    <category term=".NET" label=".NET" scheme="http://dotnettips.com/CategoryView,category,.NET.aspx" />
    <category term="AJAX" label="AJAX" scheme="http://dotnettips.com/CategoryView,category,AJAX.aspx" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://dotnettips.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Code Camp" label="Code Camp" scheme="http://dotnettips.com/CategoryView,category,Code%2BCamp.aspx" />
    <category term="Csharp" label="Csharp" scheme="http://dotnettips.com/CategoryView,category,Csharp.aspx" />
    <category term="Development" label="Development" scheme="http://dotnettips.com/CategoryView,category,Development.aspx" />
    <category term="dotNetDave" label="dotNetDave" scheme="http://dotnettips.com/CategoryView,category,dotNetDave.aspx" />
    <category term="JavaScript" label="JavaScript" scheme="http://dotnettips.com/CategoryView,category,JavaScript.aspx" />
    <category term="News" label="News" scheme="http://dotnettips.com/CategoryView,category,News.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://dotnettips.com/CategoryView,category,VB.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.cafepress.com/geekmusicart/1108056">
          </a>I hope everyone in southern
California is planning to attend this years <a href="http://socalcodecamp.com">SoCal
Code Camp</a> up at Cal State Fullerton on 1/26 -1/27. It's always a great time and
lots of free training! My fav southern California band <a href="http://killola.com">Killola</a> will
be playing again at the Geek dinner so make sure you arrive early on Saturday to grab
one of the limited number of tickets available.
</p>
        <p align="center">
          <a href="http://www.cafepress.com/geekmusicart.167020688">
            <img height="240" alt="167020688v3_240x240_Front_Color-Black.jpg" src="http://dotnettips.com/content/binary/167020688v3_240x240_Front_Color-Black.jpg" width="240" border="0" />
          </a>
        </p>
        <p>
I will be doing the following sessions and I hope you will attend.
</p>
        <h3>dotNetDave's .NET Utility Assembly (My First CodePlex Project)
</h3>
        <p>
          <a href="http://dotnettips.com/content/binary/dotNetDaves%20.NET%20Utility%20Assembly.zip">
            <img height="16" alt="zip_icon.gif" src="http://dotnettips.com/content/binary/zip_icon.gif" width="16" border="0" /> dotNetDaves
.NET Utility Assembly.zip (614.15 KB)</a>
        </p>
        <h3>Building Rich &amp; Interactive Web Applications with ASP.NET AJAX Part 1
</h3>
        <p>
          <a href="http://dotnettips.com/content/binary/dotNetDaves%20.NET%20Utility%20Assembly.zip">
            <img height="16" alt="zip_icon.gif" src="http://dotnettips.com/content/binary/zip_icon.gif" width="16" border="0" />
          </a> <a href="http://dotnettips.com/content/binary/Building%20Rich%20&amp;%20Interactive%20Web%20Applications%20with%20ASP.NET%20AJAX%20Part%201%20-%202008.zip">Building
Rich &amp; Interactive Web Applications with ASP.NET AJAX Part 1 - 2008.zip (1.39
MB)</a></p>
        <h3>Building Rich &amp; Interactive Web Applications with ASP.NET AJAX Part 2 
</h3>
        <p>
          <a href="http://dotnettips.com/content/binary/dotNetDaves%20.NET%20Utility%20Assembly.zip">
            <img height="16" alt="zip_icon.gif" src="http://dotnettips.com/content/binary/zip_icon.gif" width="16" border="0" />
          </a> <a href="http://dotnettips.com/content/binary/Building%20Rich%20&amp;%20Interactive%20Web%20Applications%20with%20ASP.NET%20AJAX%20Part%202%20-%202008.zip">Building
Rich &amp; Interactive Web Applications with ASP.NET AJAX Part 2 - 2008.zip (1.11
MB)</a></p>
        <h3>Why You Need .NET Coding Standards (2008) 
</h3>
        <p>
          <a href="http://dotnettips.com/content/binary/dotNetDaves%20.NET%20Utility%20Assembly.zip">
            <img height="16" alt="zip_icon.gif" src="http://dotnettips.com/content/binary/zip_icon.gif" width="16" border="0" />
          </a> <a href="http://dotnettips.com/content/binary/Why%20You%20Need%20.NET%20Coding%20Standards-2008.zip">Why
You Need .NET Coding Standards-2008.zip (1.71 MB)</a></p>
        <h3>Pictures and Video
</h3>
        <p align="center">
          <a title="Fullerton Code Camp - JAN 2008 by David McCarter, on Flickr" href="http://www.flickr.com/photos/davidmccarter/2224386277/">
            <img height="375" alt="Fullerton Code Camp - JAN 2008" src="http://farm3.static.flickr.com/2316/2224386277_c10367448c.jpg" width="500" border="0" />
          </a>
        </p>
        <h4>Pictures from This Years Code Camp:
</h4>
        <ul>
          <li>
            <a href="http://www.flickr.com/photos/davidmccarter/tags/fullertoncodecamp2008/">http://www.flickr.com/photos/davidmccarter/tags/fullertoncodecamp2008/</a>
          </li>
        </ul>
        <h4>Pictures from past SoCal Code Camps: 
</h4>
        <a title="Fullerton Code Camp - JAN 2008 by David McCarter, on Flickr" href="http://www.flickr.com/photos/davidmccarter/2224386277/">
        </a>
        <ul>
          <li>
            <a href="http://www.flickr.com/photos/tags/socalcodecamp/">http://www.flickr.com/photos/tags/socalcodecamp/</a>
          </li>
        </ul>
        <h4>Video from past Code Camps: 
</h4>
        <ul>
          <li>
            <a href="http://video.google.com/videoplay?docid=5746528613401358938&amp;hl=en">http://video.google.com/videoplay?docid=5746528613401358938&amp;hl=en</a>
          </li>
          <li>
            <a href="http://video.google.com/videoplay?docid=-3743731164665646189&amp;hl=en">http://video.google.com/videoplay?docid=-3743731164665646189&amp;hl=en</a>
          </li>
          <li>
            <a href="http://video.google.com/videoplay?docid=-8296273637053089146&amp;hl=en">http://video.google.com/videoplay?docid=-8296273637053089146&amp;hl=en</a>
          </li>
          <li>
            <a href="http://video.google.com/videoplay?docid=-8271841448294012140&amp;hl=en">http://video.google.com/videoplay?docid=-8271841448294012140&amp;hl=en</a>
          </li>
        </ul>
        <p>
          <a href="http://dotnettips.com/content/binary/Building%20Rich%20&amp;%20Interactive%20Web%20Applications%20with%20ASP.NET%20AJAX%20Part%201%20-%202008.zip">
          </a> 
</p>
        <p>
          <a href="http://dotnettips.com/content/binary/Building%20Rich%20&amp;%20Interactive%20Web%20Applications%20with%20ASP.NET%20AJAX%20Part%202%20-%202008.zip">
          </a> 
</p>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=7f25dd65-6c26-4a00-bdda-936245ca9722" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Checking Permissions Before Accessing A File</title>
    <link rel="alternate" type="text/html" href="http://dotnettips.com/2008/01/02/CheckingPermissionsBeforeAccessingAFile.aspx" />
    <id>http://dotnettips.com/PermaLink,guid,18198498-0f12-41cf-b211-647aa3dff625.aspx</id>
    <published>2008-01-02T13:01:35.5780000-08:00</published>
    <updated>2008-01-03T13:13:00.2749083-08:00</updated>
    <category term="VB.NET" label="VB.NET" scheme="http://dotnettips.com/CategoryView,category,VB.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Often, it's a good idea to make sure the user trying to access the file has permissions
to it before performing an operation like read, write or delete. Below is code that
makes this pretty easy.
</p>
        <!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}??\fs20    \cf3 Friend\cf0  \cf3 Shared\cf0  \cf3 Sub\cf0  DemandFileReadPermission(\cf3 ByVal\cf0  fileName \cf3 As\cf0  \cf3 String\cf0 )\par ??      \cf3 If\cf0  System.IO.File.Exists(fileName) \cf3 Then\par ??\cf0         \cf3 Dim\cf0  filePermission \cf3 As\cf0  \cf3 New\cf0  System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Read, System.Security.AccessControl.AccessControlActions.View, fileName)\par ??        filePermission.Demand()\par ??      \cf3 End\cf0  \cf3 If\par ??\cf0     \cf3 End\cf0  \cf3 Sub\par ??\par ??\cf0     \cf3 Friend\cf0  \cf3 Shared\cf0  \cf3 Sub\cf0  DemandFileWritePermission(\cf3 ByVal\cf0  fileName \cf3 As\cf0  \cf3 String\cf0 )\par ??      \cf3 If\cf0  System.IO.File.Exists(fileName) \cf3 Then\par ??\cf0         \cf3 Dim\cf0  destinationFilePermission \cf3 As\cf0  \cf3 New\cf0  System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Write, System.Security.AccessControl.AccessControlActions.Change, fileName)\par ??        destinationFilePermission.Demand()\par ??      \cf3 End\cf0  \cf3 If\par ??\cf0     \cf3 End\cf0  \cf3 Sub}
-->
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
  <span style="COLOR: blue">Sub</span> DemandFileReadPermission(<span style="COLOR: blue">ByVal</span> fileName <span style="COLOR: blue">As</span><span style="COLOR: blue">String</span>)
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
    <span style="COLOR: blue">If</span> System.IO.File.Exists(fileName) <span style="COLOR: blue">Then</span></p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
      <span style="COLOR: blue">Dim</span> filePermission <span style="COLOR: blue">As</span><span style="COLOR: blue">New</span> System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Read,
System.Security.AccessControl.AccessControlActions.View, fileName)
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
      filePermission.Demand()
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
    <span style="COLOR: blue">End</span><span style="COLOR: blue">If</span></p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
  <span style="COLOR: blue">End</span><span style="COLOR: blue">Sub</span></p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
 
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
  <span style="COLOR: blue">Sub</span> DemandFileWritePermission(<span style="COLOR: blue">ByVal</span> fileName <span style="COLOR: blue">As</span><span style="COLOR: blue">String</span>)
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
    <span style="COLOR: blue">If</span> System.IO.File.Exists(fileName) <span style="COLOR: blue">Then</span></p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
      <span style="COLOR: blue">Dim</span> destinationFilePermission <span style="COLOR: blue">As</span><span style="COLOR: blue">New</span> System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Write,
System.Security.AccessControl.AccessControlActions.Change, fileName)
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
      destinationFilePermission.Demand()
</p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
    <span style="COLOR: blue">End</span><span style="COLOR: blue">If</span></p>
        <p style="FONT-SIZE: 10pt; BACKGROUND: white; MARGIN: 0px; COLOR: black; FONT-FAMILY: Courier New">
  <span style="COLOR: blue">End</span><span style="COLOR: blue">Sub</span></p>
        <p>
One warning though... performing a permission .Demand takes time. In a quick test
on my machine it was a pretty consistent 10 milliseconds. So you might not want to
do this all of the time.
</p>
        <strong>
          <font color="#006400">Tip by: David McCarter</font>
        </strong>
        <img width="0" height="0" src="http://dotnettips.com/aggbug.ashx?id=18198498-0f12-41cf-b211-647aa3dff625" />
      </div>
    </content>
  </entry>
</feed>