<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" 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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
  <channel>
    <title>Klocko.com Blog</title>
    <description />
    <link>http://klocko.com/blog/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.Net Syndication Generator 1.0.0.0 (http://dotnetblogengine.net/)</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://klocko.com/blog/opml.axd</blogChannel:blogRoll>
    <dc:creator>Doug Klocko</dc:creator>
    <dc:title>Klocko.com Blog</dc:title>
    <geo:lat>40.612650</geo:lat>
    <geo:long>-79.938620</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/klocko" type="application/rss+xml" /><item>
      <title>Personal Web Site Starter Kit Security Exceptions Using 1and1 Hosting</title>
      <description>&lt;p&gt;
Before starting to use &lt;strong&gt;Personal Web Site Starter Kit&lt;/strong&gt; (PWS), I had a hosting package with &lt;a href="http://www.1and1.com/" target="_blank"&gt;1and1&lt;/a&gt;.&amp;nbsp; I assumed, because the package supported .Net, I would be able to use 1and1 to host PWS.&amp;nbsp; Well, most of my development is for corporate environments, so I typically can run applications in Full Trust.&amp;nbsp; The limitations of Medium Trust were all new to me.
&lt;/p&gt;
  
&lt;p&gt;
I was forced to learn a little bit about Medium Trust because PWS would sporadically generate an Exception when using 1and1 Hosting...
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://klocko.com/blog/image.axd?picture=WindowsLiveWriter/PersonalWebSiteStarterKitSecurityExcepti_118D6/Security_Exception_PWS_2.jpg"&gt;&lt;img style="border: 0px none " src="http://klocko.com/blog/image.axd?picture=WindowsLiveWriter/PersonalWebSiteStarterKitSecurityExcepti_118D6/Security_Exception_PWS_thumb.jpg" border="0" alt="Security_Exception_PWS" width="361" height="319" /&gt;&lt;/a&gt; 
&lt;/p&gt;
  
&lt;p&gt;
Here is part of the stack trace exception, &amp;quot;&lt;strong&gt;System.Security.Permissions.FileIOPermission&lt;/strong&gt;&amp;quot;...
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://klocko.com/blog/image.axd?picture=WindowsLiveWriter/PersonalWebSiteStarterKitSecurityExcepti_118D6/Stack_Trace_PWS_2.jpg"&gt;&lt;img style="border: 0px none " src="http://klocko.com/blog/image.axd?picture=WindowsLiveWriter/PersonalWebSiteStarterKitSecurityExcepti_118D6/Stack_Trace_PWS_thumb.jpg" border="0" alt="Stack_Trace_PWS" width="499" height="223" /&gt;&lt;/a&gt;&amp;nbsp;
&lt;/p&gt;
  
&lt;p&gt;
Here are some links that were helpful for me when learning about ASP.Net and Medium Trust:
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/ms998341.aspx" target="_blank"&gt;How To: Use Medium Trust in ASP.Net 2.0&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://odetocode.com/Blogs/scott/archive/2005/10/28/2394.aspx" target="_blank"&gt;Medium Trust ASP.NET Applications&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://aspnet.4guysfromrolla.com/articles/100307-1.aspx" target="_blank"&gt;Hosting ASP.NET Applications in Medium Trust&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://blogs.msdn.com/shawnfa/archive/2004/07/30/202468.aspx" target="_blank"&gt;Security Exceptions&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://nayyeri.net/blog/Medium-trust-issue-in-ASP-NET-2-0/" target="_blank"&gt;Medium Trust Issue in ASP.Net 2.0&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
I knew my exception was related to File IO, but it was sporadic/inconsistent and the code was not doing anything special.&amp;nbsp; I saw in the Stack Trace that the Site Map Provider was involved.&amp;nbsp; 
&lt;/p&gt;
  
&lt;p&gt;
To try and work around the exception, I wrote a custom provider that derived from the &lt;strong&gt;XmlSiteMapProvider&lt;/strong&gt; and overrode the &lt;strong&gt;IsAccessibleToUser&lt;/strong&gt; method so that it did not access the file system.&amp;nbsp; This seemed to reduce the frequency, but the problem was not gone.&amp;nbsp; 
&lt;/p&gt;
  
&lt;p&gt;
Next, I set &lt;strong&gt;SecurityTrimmingEnabled&lt;/strong&gt; to false.&amp;nbsp; Again, this seemed to further reduce the frequency, but the problem was not gone.&amp;nbsp; I read that the &lt;strong&gt;XmlSiteMapProvider&lt;/strong&gt; monitors the file system for any changes to the XML file.
&lt;/p&gt;
  
&lt;p&gt;
At this point, I was going to lose a lot of functionality, so I decided to look for another place to host my application.&amp;nbsp; I checked out &lt;a href="http://www.godaddy.com/gdshop/default.asp" target="_blank"&gt;GoDaddy.com&lt;/a&gt;.&amp;nbsp; Here is what each said about Trust level..
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://faq.1and1.com/scripting_languages_supported/_net/15.html" target="_blank"&gt;1and1 FAQ: Restrictions in hosting ASP.Net applications&lt;/a&gt;
&lt;/p&gt;
 &lt;a href="http://help.godaddy.com/topic/216/article/1039" target="_blank"&gt;Godaddy FAQ: What Is Medium trust level and how does it affect my hosting account?&lt;/a&gt;  
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
I have since moved to GoDaddy without any problems.
&lt;/p&gt;
</description>
      <link>http://klocko.com/blog/post/2008/03/Personal-Web-Site-Starter-Kit-Security-Exceptions-Using-1and1-Hosting.aspx</link>
      <author>Doug Klocko</author>
      <comments>http://klocko.com/blog/post/2008/03/Personal-Web-Site-Starter-Kit-Security-Exceptions-Using-1and1-Hosting.aspx#comment</comments>
      <guid>http://klocko.com/blog/post.aspx?id=7abdf21e-180f-40af-aeb3-f8b1e3fa0385</guid>
      <pubDate>Sun, 30 Mar 2008 18:58:00 -0700</pubDate>
      <category>.Net</category>
      <dc:publisher>Doug Klocko</dc:publisher>
      <pingback:server>http://klocko.com/blog/pingback.axd</pingback:server>
      <pingback:target>http://klocko.com/blog/post.aspx?id=7abdf21e-180f-40af-aeb3-f8b1e3fa0385</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://klocko.com/blog/trackback.axd?id=7abdf21e-180f-40af-aeb3-f8b1e3fa0385</trackback:ping>
      <wfw:comment>http://klocko.com/blog/post/2008/03/Personal-Web-Site-Starter-Kit-Security-Exceptions-Using-1and1-Hosting.aspx#comment</wfw:comment>
      <wfw:commentRss>http://klocko.com/blog/syndication.axd?post=7abdf21e-180f-40af-aeb3-f8b1e3fa0385</wfw:commentRss>
    </item>
    <item>
      <title>Customizing Personal Web Site Starter Kit</title>
      <description>&lt;p&gt;
My initial interest in the &lt;strong&gt;&lt;a href="http://www.asp.net/downloads/starter-kits/personal/" target="_blank"&gt;Personal Web Site Starter Kit&lt;/a&gt; (PWS) &lt;/strong&gt;was the photo gallery functionality that was included.&amp;nbsp; But I have found a little time here and there to make some minor customizations. 
&lt;/p&gt;
&lt;p&gt;
First, if you are just starting to use PWS, here are some links for key background information... 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.asp.net/downloads/starter-kits/personal/" target="_blank"&gt;Personal Web Site Download&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/ms972963.aspx" target="_blank"&gt;Introduction to the Personal Web Site Starter Kit&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/aa479336.aspx" target="_blank"&gt;Extending the Personal Web Site Starter Kit&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Second, here are the minor customizations I have done and supporting links... 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://webproject.scottgu.com/CSharp/migration2/migration2.aspx" target="_blank"&gt;Convert Personal Web Site Starter Kit to Web Application Project&lt;/a&gt; (WAP): I am much more familiar and comfortable with &lt;a href="http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx"&gt;WAP development model&lt;/a&gt;, so making this change was a must.&amp;nbsp; The WAP model is similar to the way things worked with Web Projects in Visual Studio 2003. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://weblogs.asp.net/bsimser/archive/2005/11/30/431896.aspx" target="_blank"&gt;Use SQL Server 2005 with Personal Web Site Starter Kit&lt;/a&gt;: This was necessary because my and many other hosting providers do not allow SQL Server Express Edition. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://klocko.com/blog/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit-to-Save-Photos-to-the-File-System.aspx"&gt;Customizing Personal Web Site Starter Kit to Save Photos to the File System&lt;/a&gt;: This was needed to take advantage of my available hosting space. 
&lt;/p&gt;
&lt;p&gt;
Other Small Customizations: Added category attribute to the albums; Modified Handler.ashx to allow for direct file downloads of original image files; Basic integration with &lt;a href="http://www.dotnetblogengine.net/"&gt;BlogEngine.Net&lt;/a&gt; and &lt;a href="http://www.codeplex.com/SlideShow"&gt;Slide.Show&lt;/a&gt; (cool &lt;a href="http://silverlight.net/" target="_blank"&gt;Silverlight&lt;/a&gt; application), which I can detail in a future entry. 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
If you are&amp;nbsp;not into doing customizations yourself, I have come across a number of enhanced versions of PWS that are available... 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.willyd.ca/Default.aspx" target="_blank" title="http://www.willyd.ca/Default.aspx"&gt;http://www.willyd.ca/Default.aspx&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://jeremywadsworth.com/" target="_blank"&gt;Extended Personal Web Site Starter Kit&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codeplex.com/EPWSK" target="_blank"&gt;Extended Personal Web Site Starter Kit on CodePlex&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.edream.org/BlogArticle.aspx?RecordID=108" target="_blank"&gt;http://www.edream.org/BlogArticle.aspx?RecordID=108&lt;/a&gt;&amp;nbsp; 
&lt;/p&gt;
</description>
      <link>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit.aspx</link>
      <author>Doug Klocko</author>
      <comments>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit.aspx#comment</comments>
      <guid>http://klocko.com/blog/post.aspx?id=73f49d97-63c8-46f6-9f02-a3cf611e4a67</guid>
      <pubDate>Sat, 22 Mar 2008 16:36:00 -0700</pubDate>
      <category>.Net</category>
      <dc:publisher>Doug Klocko</dc:publisher>
      <pingback:server>http://klocko.com/blog/pingback.axd</pingback:server>
      <pingback:target>http://klocko.com/blog/post.aspx?id=73f49d97-63c8-46f6-9f02-a3cf611e4a67</pingback:target>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://klocko.com/blog/trackback.axd?id=73f49d97-63c8-46f6-9f02-a3cf611e4a67</trackback:ping>
      <wfw:comment>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit.aspx#comment</wfw:comment>
      <wfw:commentRss>http://klocko.com/blog/syndication.axd?post=73f49d97-63c8-46f6-9f02-a3cf611e4a67</wfw:commentRss>
    </item>
    <item>
      <title>Customizing Personal Web Site Starter Kit to Save Photos to the File System</title>
      <description>&lt;p&gt;
I know that others have faced the same problem as me when it comes to using &lt;strong&gt;&lt;a href="http://www.asp.net/downloads/starter-kits/personal/" target="_blank"&gt;Personal Web Site Starter Kit&lt;/a&gt;&lt;/strong&gt; (&lt;strong&gt;PWS&lt;/strong&gt;) with their hosting provider because of limited database space.&amp;nbsp; I have used &lt;a href="http://1and1.com" target="_blank"&gt;1and1&lt;/a&gt; and &lt;a href="http://godaddy.com" target="_blank"&gt;GoDaddy&lt;/a&gt; and both of them offer a small amount of space within the included &lt;strong&gt;SQL Server&lt;/strong&gt; database(s), but an abundance of file system space.&amp;nbsp; The photo albums were my primary reason for using &lt;strong&gt;PWS,&lt;/strong&gt; but I did not want to spend a lot of time making it useable.&amp;nbsp; I ended up making some quick &amp;amp; dirty modifications to the &lt;strong&gt;PWS&lt;/strong&gt; code to save the image files to the file system instead.&amp;nbsp; The various sizes of the photos are all saved to the file system as shown:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;img src="http://klocko.com/blog/image.axd?picture=photo_listing.jpg" alt="photo listing" /&gt;
&lt;/p&gt;
&lt;p&gt;
Here are the changes I made: 
&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
	&lt;div&gt;
	Add a &amp;quot;Photos&amp;quot; folder to the root of the application.&amp;nbsp; This is the folder where the photo files will be stored.&amp;nbsp; (You will need to&amp;nbsp;set Write permissions on this folder.) 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	In the &amp;quot;Personal&amp;quot; database, delete the Tables (&amp;quot;photos&amp;quot;, &amp;quot;albums&amp;quot;) and all the Stored Procedures.&amp;nbsp; Then, run the modified &amp;quot;personal-add.sql&amp;quot; script below.&amp;nbsp; This modified SQL script will create new tables without fields for the actual files and new procedures modified as needed because the photos are being saved to the file system. 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	Replace the &amp;quot;PhotoManager.vb&amp;quot; file with the one below. This modified class has the necessary changes to handle managing photo files on the file system, rather than in the database. 
	&lt;/div&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;div&gt;
	Replace the &amp;quot;Handler.ashx&amp;quot; file with the one below.&amp;nbsp; This modified class has a single change to explicitly close the Stream object which can cause problems if a photo is being deleted. 
	&lt;/div&gt;
	&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;a rel="enclosure" href="http://klocko.com/blog/file.axd?file=Modified_personal-add.sql" target="_blank"&gt;Modified_personal-add.sql (3.41 kb)&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a rel="enclosure" href="http://klocko.com/blog/file.axd?file=Modified_PhotoManager.vb" target="_blank"&gt;Modified_PhotoManager.vb (13.79 kb)&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a rel="enclosure" href="http://klocko.com/blog/file.axd?file=modified_Handler.ashx" target="_blank"&gt;modified_Handler.ashx (1.87 kb)&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;After completing this, I found this &lt;a href="http://geekswithblogs.net/jhacheysblog/articles/62519.aspx" target="_blank"&gt;post&lt;/a&gt; with another set of modifications that it looks like it uses a little different approach. 
&lt;/p&gt;
</description>
      <link>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit-to-Save-Photos-to-the-File-System.aspx</link>
      <author>Doug Klocko</author>
      <comments>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit-to-Save-Photos-to-the-File-System.aspx#comment</comments>
      <guid>http://klocko.com/blog/post.aspx?id=9b03f34a-bf3f-453f-aa90-04e0781a472e</guid>
      <pubDate>Fri, 14 Mar 2008 22:53:00 -0700</pubDate>
      <category>.Net</category>
      <dc:publisher>Doug Klocko</dc:publisher>
      <pingback:server>http://klocko.com/blog/pingback.axd</pingback:server>
      <pingback:target>http://klocko.com/blog/post.aspx?id=9b03f34a-bf3f-453f-aa90-04e0781a472e</pingback:target>
      <slash:comments>4</slash:comments>
      <trackback:ping>http://klocko.com/blog/trackback.axd?id=9b03f34a-bf3f-453f-aa90-04e0781a472e</trackback:ping>
      <wfw:comment>http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit-to-Save-Photos-to-the-File-System.aspx#comment</wfw:comment>
      <wfw:commentRss>http://klocko.com/blog/syndication.axd?post=9b03f34a-bf3f-453f-aa90-04e0781a472e</wfw:commentRss>
    </item>
    <item>
      <title>Welcome to Klocko.com Blog!</title>
      <description>This is my first entry in the blog.&amp;nbsp; It was a little bit of an effort to get it installed and configured the way I want along with Personal Web Site Starter Kit.&amp;nbsp; But now that it is done, I am happy with the set up. 
</description>
      <link>http://klocko.com/blog/post/2008/03/Welcome-to-Klockocom-Blog!.aspx</link>
      <author>Doug Klocko</author>
      <comments>http://klocko.com/blog/post/2008/03/Welcome-to-Klockocom-Blog!.aspx#comment</comments>
      <guid>http://klocko.com/blog/post.aspx?id=575c6044-4400-4e34-9f7c-6caf846319dd</guid>
      <pubDate>Sat, 01 Mar 2008 14:00:00 -0700</pubDate>
      <category>.Net</category>
      <category>Klocko.com</category>
      <category>Family</category>
      <dc:publisher>Doug Klocko</dc:publisher>
      <pingback:server>http://klocko.com/blog/pingback.axd</pingback:server>
      <pingback:target>http://klocko.com/blog/post.aspx?id=575c6044-4400-4e34-9f7c-6caf846319dd</pingback:target>
      <slash:comments>7</slash:comments>
      <trackback:ping>http://klocko.com/blog/trackback.axd?id=575c6044-4400-4e34-9f7c-6caf846319dd</trackback:ping>
      <wfw:comment>http://klocko.com/blog/post/2008/03/Welcome-to-Klockocom-Blog!.aspx#comment</wfw:comment>
      <wfw:commentRss>http://klocko.com/blog/syndication.axd?post=575c6044-4400-4e34-9f7c-6caf846319dd</wfw:commentRss>
    </item>
  </channel>
</rss>
