<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" 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:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 - Discussions by jrg</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Niners/jrg/Discussions/RSS"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 - Discussions by jrg</title>
		<link>http://channel9.msdn.com/Niners/jrg/Discussions</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Niners/jrg/Discussions</link>
	<language>en</language>
	<pubDate>Tue, 18 Jun 2013 22:00:54 GMT</pubDate>
	<lastBuildDate>Tue, 18 Jun 2013 22:00:54 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>0</c9:totalResults>
	<c9:pageCount>0</c9:pageCount>
	<c9:pageSize>0</c9:pageSize>
	<item>
		<title>Tech Off - Set IIsWebDirectory Permissions via WMI in C#</title>
		<description><![CDATA[<p><blockquote>
<div>mrichman wrote:</div>
<div>Yet another setback I discovered is that to create a Metabase entry for /foo/bar, its parent key /foo must exist.<br>
<br>
Looks like I need to create a recursive method for creating a key if and only if its parent exists (creating the parent key if not there).<br>
<br>
Kill me now please.<br>
</div>
</blockquote>
<br>
<br>
Copyright your problem and solution before it becomes the next Microsoft interview question! <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-4.gif' alt='Tongue Out' /><br>
<br>
&quot;Umm, let me think, string path = &quot;some/path&quot;; string [] pathParts = path.Split('/');&nbsp; recursiveFunction(rootPath, pathParts, 0)...&quot;<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/ac5ce41c492b435bb3459dea011a712b#ac5ce41c492b435bb3459dea011a712b</link>
		<pubDate>Sat, 12 Mar 2005 15:32:09 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/ac5ce41c492b435bb3459dea011a712b#ac5ce41c492b435bb3459dea011a712b</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>14</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Set IIsWebDirectory Permissions via WMI in C#</title>
		<description><![CDATA[<p>I'm doing a compare and contrast with your code and some Microsoft example code in VBScript:<br>
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/504d8e75-4a12-433b-8894-ac7fd414a634.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/504d8e75-4a12-433b-8894-ac7fd414a634.asp</a><br>
<br>
I know the following is using IIsWebVirtualDirectory rather than IIsWebDirectory but the concept should still be valid:<br>
<pre><sub>const APP_POOLED = 2 <br>var strNewVdir <br>strNewVdir = &quot;W3SVC/1/Root/newVdir&quot; <br> <br>' Make connections to WMI, to the IIS namespace on MyMachine. <br>set locatorObj = CreateObject(&quot;WbemScripting.SWbemLocator&quot;) <br>set providerObj = locatorObj.ConnectServer(&quot;MyMachine&quot;, &quot;root/MicrosoftIISv2&quot;) <br> <br>' Add a virtual directory to the site. This requires SpawnInstance(). <br>Set vdirClassObj = providerObj.Get(&quot;IIsWebVirtualDirSetting&quot;) <br>Set vdirObj = vdirClassObj.SpawnInstance_() <br>vdirObj.Name = strNewVdir <br>vdirObj.Path = &quot;C:\Inetpub\Wwwroot&quot; <br>vdirObj.AuthFlags = 5 ' AuthNTLM &#43; AuthAnonymous <br>vdirObj.EnableDefaultDoc = True <br>vdirObj.DirBrowseFlags = &amp;H4000003E ' date, time, size, extension, longdate <br>vdirObj.AccessFlags = 513 ' read, script <br> <br>' Save the new settings to the metabase <br>vdirObj.Put_() <br> <br>' Create a pooled application on the new virtual directory. <br>Set vdirObj = providerObj.Get(&quot;IIsWebVirtualDir='&quot; &amp; strNewVdir &amp; &quot;'&quot;) <br>vdirObj.AppCreate2(2) <br> <br>' Set the application name. <br>Set vdirObj = providerObj.Get(&quot;IIsWebVirtualDirSetting='&quot; &amp; strNewVdir &amp; &quot;'&quot;) <br>vdirObj.AppFriendlyName = &quot;Root Application&quot; <br>vdirObj.Put_()</sub></pre>
&quot;SpawnInstance()&quot; sticks out as something to research as they say it is &quot;required&quot; which tells me it can be a sticky point.&nbsp; It appears that they create the object without yet giving the path... just create an IIsWebDirectorySetting object first, no path.&nbsp;
 Next, on your object, set the properties.&nbsp; I'm not set up to test this so forgive me if this is getting off base.&nbsp; Once you've set your properties, including a path and name, then you may find it does the Put properly.<br>
<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/c640fd9f459b408aa34a9dea011a707a#c640fd9f459b408aa34a9dea011a707a</link>
		<pubDate>Thu, 10 Mar 2005 21:26:05 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/c640fd9f459b408aa34a9dea011a707a#c640fd9f459b408aa34a9dea011a707a</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>14</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>Here's a fun one I ran into yesterday... not exactly part of this thread but I don't think it's justified to start a new thread:<br>
<br>
Given an abstract class, create a field that is readonly which can be set by inheriting classes.<br>
<br>
const fields are compiler time only.<br>
readonly fields are allowed to be set at runtime in the constructor or as a field initialization.&nbsp; This definition is a little gray in addressing &quot;what about inheriting types and their constructors?&quot;<br>
<br>
The answer is that readonly cannot be set by the inheriting class.<br>
<br>
Here's one way to get that functionality though:<br>
<br>
public abstract class A<br>
{<br>
&nbsp;&nbsp; protected readonly int myField;<br>
&nbsp;&nbsp; protected A(int myField)<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.myField = myField;<br>
&nbsp;&nbsp; }<br>
}<br>
<br>
public class B:A<br>
{<br>
&nbsp;&nbsp; public B(): base(4) // valid<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp; // base.myField = 4; // invalid<br>
&nbsp;&nbsp; }<br>
}<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/9bc6e9b6cdd24184943b9dea011a6895#9bc6e9b6cdd24184943b9dea011a6895</link>
		<pubDate>Thu, 10 Mar 2005 20:35:59 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/9bc6e9b6cdd24184943b9dea011a6895#9bc6e9b6cdd24184943b9dea011a6895</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>Yep... it's a pretty cool exercise though... you never know what you don't know until it presents itself and you work it out. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /><br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/61de3f6d73c9478585d79dea011a686c#61de3f6d73c9478585d79dea011a686c</link>
		<pubDate>Thu, 10 Mar 2005 20:27:56 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/61de3f6d73c9478585d79dea011a686c#61de3f6d73c9478585d79dea011a686c</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>I think in a way it's the same yet an inverse, if that makes any sense.&nbsp; An analogy would be that Object is the universal template for all types.&nbsp; The problem though is when an implicit cast happens, right?&nbsp; If the compiler casts for you, it just did an
 end-around on your strategy to force a template.<br>
<br>
Here we go...<br>
Forcing a reference type in one method signature can be done with &quot;ref&quot;:<br>
<br>
public void Add(ref Object referenceType)<br>
{<br>
}<br>
<br>
// this does not cover all other types<br>
public void Add(ValueType valueType)<br>
{<br>
}<br>
<br>
I just tested and when you have only those two method signatures, you have nothing covering a type such as a String.&nbsp; So ValueType appears to be specific to structs.<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/39ef539706274342bdcc9dea011a681d#39ef539706274342bdcc9dea011a681d</link>
		<pubDate>Thu, 10 Mar 2005 20:25:34 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/39ef539706274342bdcc9dea011a681d#39ef539706274342bdcc9dea011a681d</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>Oh man, you said the word &quot;can't&quot;... and I can't resist the word <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-4.gif' alt='Tongue Out' /><br>
<br>
Not the same way of course, no.&nbsp; Templates are such a cool OOP tool and the STL serves good testament to that.&nbsp; I think it's just a paradigm shift in C# regarding types as they're all derived from Object and value types from Object then ValueType.<br>
<br>
public void Add(ValueType item)<br>
{<br>
}<br>
<br>
This should force the developer consuming your method to cast.&nbsp; If they can't cast to a value type then you'd be assured when you do receive an object you're receiving a value type.&nbsp; It's still an object, just limited to a specific type of core object.<br>
<br>
I haven't tested this, and in reading, ValueType is stated as the base type for structs whether struct is a subset of ValueType or the defiinition of the set I don't know... 10 second test program time <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /><br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/425314088b864f7b95c29dea011a67cd#425314088b864f7b95c29dea011a67cd</link>
		<pubDate>Thu, 10 Mar 2005 20:04:51 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/425314088b864f7b95c29dea011a67cd#425314088b864f7b95c29dea011a67cd</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>I agree as well.&nbsp; We'd have to hear from the author what the intentions are, or what the problem is.&nbsp;
<br>
<br>
It was indicated that boxing was seen as a problem.&nbsp; The method appears to be purposely very generic, perhaps for a library.&nbsp; If boxing based performance was a problem where Add involved a significant order of N (huge sorting? crypto?), I think it would be
 a better path to polymorph and optimize rather than generalize.<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/4202c71e707f4fbbb1089dea011a66c9#4202c71e707f4fbbb1089dea011a66c9</link>
		<pubDate>Thu, 10 Mar 2005 12:44:01 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/4202c71e707f4fbbb1089dea011a66c9#4202c71e707f4fbbb1089dea011a66c9</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Set IIsWebDirectory Permissions via WMI in C#</title>
		<description><![CDATA[<p>Are you on IIS 6.0?<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/3c7fb7a95ab441a28c669dea011a701d#3c7fb7a95ab441a28c669dea011a701d</link>
		<pubDate>Thu, 10 Mar 2005 12:29:19 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/3c7fb7a95ab441a28c669dea011a701d#3c7fb7a95ab441a28c669dea011a701d</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>14</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Set IIsWebDirectory Permissions via WMI in C#</title>
		<description><![CDATA[<p>Hi Mark,<br>
<br>
Sorry about the wrong tangent! <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /><br>
<br>
You'd like to set up an IIS virtual directory through C# and WMI and have the operation perform just like you were doing mmc configuration of a new virtual directory?<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/333ab74499264c5bbff89dea011a6f6f#333ab74499264c5bbff89dea011a6f6f</link>
		<pubDate>Thu, 10 Mar 2005 05:34:08 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/333ab74499264c5bbff89dea011a6f6f#333ab74499264c5bbff89dea011a6f6f</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>14</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - Set IIsWebDirectory Permissions via WMI in C#</title>
		<description><![CDATA[<p>Hehe, yeah, this is a fun one.<br>
<br>
First, there is a utility (vbscript) available to help you set permissions:<br>
<a href="http://support.microsoft.com/kb/267904">http&#58;&#47;&#47;support.microsoft.com&#47;kb&#47;267904</a><br>
<br>
Second, if you can avoid using anonymous access, that's best.&nbsp; Use impersonation to tell your ASP code &quot;act like the user that is using this&quot;.<br>
<br>
I just saw your &quot;NO VBSCRIPT&quot; comment... sorry about that.<br>
<br>
I was looking at this exact problem about a month ago because I wanted to stay away from scripts as well.&nbsp; P-Invoke is an ugly but sometimes necessary approach when it comes to ACE/ACL.&nbsp; I know Microsoft is adding new permission toys in 2.0.<br>
<br>
This may be of help:<br>
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/setting_user_security.asp">http&#58;&#47;&#47;msdn.microsoft.com&#47;library&#47;default.asp&#63;url&#61;&#47;library&#47;en-us&#47;wmisdk&#47;wmi&#47;setting_user_security.asp</a><br>
<b>&quot;Note</b>&nbsp;&nbsp;A NULL ACL in the <a href="http://msdn.microsoft.com/library/en-us/secauthz/security/security_descriptor.asp">
<b>SECURITY_DESCRIPTOR</b></a> grants unlimited access to everyone all the time. For more information about the implications of unlimited access, see
<a href="http://msdn.microsoft.com/library/en-us/secauthz/security/creating_a_security_descriptor_for_a_new_object_in_c__.asp">
Creating a Security Descriptor for a New Object</a>.&quot;<br>
<br>
&lt;still looking for a better answer... will revise this in a few.. I want to know as well <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' />&gt;<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/53db005a18b84193bda49dea011a6f19#53db005a18b84193bda49dea011a6f19</link>
		<pubDate>Thu, 10 Mar 2005 02:04:48 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45432-Set-IIsWebDirectory-Permissions-via-WMI-in-C/53db005a18b84193bda49dea011a6f19#53db005a18b84193bda49dea011a6f19</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>14</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>Try testing the type perhaps:<br>
item.GetType().IsValueType;</p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/2a6f03121b49470bb74a9dea011a661d#2a6f03121b49470bb74a9dea011a661d</link>
		<pubDate>Wed, 09 Mar 2005 19:05:29 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/2a6f03121b49470bb74a9dea011a661d#2a6f03121b49470bb74a9dea011a661d</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Tech Off - T == null =&amp;gt; Boxing = Problem</title>
		<description><![CDATA[<p>Yeah, null itself of course serves as the placeholder for a reference type pointing nowhere.&nbsp; I'm not putting much thought into this but it seems logical for a null to signify the existence of a reference type operand on the other side of the comparison
 operator.&nbsp; int x = null; wouldn't make much sense right?<br></p>]]></description>
		<link>http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/ef4dea450073419989bc9dea011a6599#ef4dea450073419989bc9dea011a6599</link>
		<pubDate>Wed, 09 Mar 2005 18:56:53 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/TechOff/45265-T--null-gt-Boxing--Problem/ef4dea450073419989bc9dea011a6599#ef4dea450073419989bc9dea011a6599</guid>
		<dc:creator>jrg</dc:creator>
		<slash:comments>18</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/jrg/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>