<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Living .NET...  - All Comments</title><link>http://msmvps.com/blogs/manoj/default.aspx</link><description>Musings on .NET, and the like - Manoj G</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: String.Format: A Simple Tip</title><link>http://msmvps.com/blogs/manoj/archive/2004/09/29/String.Format_3A00_-A-Simple-Tip.aspx#1602051</link><pubDate>Thu, 24 Apr 2008 02:50:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1602051</guid><dc:creator>visitor</dc:creator><description>&lt;p&gt;2 points.&lt;/p&gt;
&lt;p&gt;1. watch out for {0) which looks a lot like {0} which if you&amp;#39;re typing fast can happen quite frequently...will result in a very strange message you could end up surfing around for hours trying to find what&amp;#39;s wrong...not that that&amp;#39;s happened to me or anything.&lt;/p&gt;
&lt;p&gt;2. as far as sql injection we do something like this:&lt;/p&gt;
&lt;p&gt;String.Format(&amp;quot;sql goes here where id = {0}&amp;quot;, SqlTool.StringToSQL(m_String));&lt;/p&gt;
&lt;p&gt;and have a separate class that handles the &amp;#39;&amp;#39; stuff... this allows you to escape things neatly behind the scenes, still use string.format, and keep code consistent, and still use intellisense to make things speedy...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1602051" width="1" height="1"&gt;</description></item><item><title>re: Throw Trap</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/24/16550.aspx#1541079</link><pubDate>Wed, 12 Mar 2008 16:07:45 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1541079</guid><dc:creator>Ulf</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a question or need to get some thing confirmed because I&amp;#39;m a bit unsure about this.&lt;/p&gt;
&lt;p&gt;Looking at Lance Hunts guideline paragraph 4.4 the example says&lt;/p&gt;
&lt;p&gt;// Bad!&lt;/p&gt;
&lt;p&gt;catch(Exception ex)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Log(ex);&lt;/p&gt;
&lt;p&gt;throw ex;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;// Good!&lt;/p&gt;
&lt;p&gt;catch(Exception)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Log(ex);&lt;/p&gt;
&lt;p&gt;throw;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;As I understand it is not possible to do as in the good example, since ex is not declared. Or am I wrong?&lt;/p&gt;
&lt;p&gt;If I do the good example as you do it, it seems that I get the same result. I&amp;#39;m I right about that?&lt;/p&gt;
&lt;p&gt;// Good! (Modified)&lt;/p&gt;
&lt;p&gt;catch(Exception ex)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Log(ex);&lt;/p&gt;
&lt;p&gt;throw;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1541079" width="1" height="1"&gt;</description></item><item><title>re: BackgroundWorker and SynchronizationContext</title><link>http://msmvps.com/blogs/manoj/archive/2005/11/03/74120.aspx#1514256</link><pubDate>Thu, 14 Feb 2008 14:12:54 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1514256</guid><dc:creator>Martin Golding</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt;But from a thread with just has a standard&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;SynchronizationContext, the send and post method of&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;this context do not marshall the call to a specific&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;thread!&lt;/p&gt;
&lt;p&gt;Does a standard SynchronizationContext enable the ability to marshall to the original thread?&lt;/p&gt;
&lt;p&gt;All of my test code says no, If I output Thread.GetHashCode() and write test code I can see when using ctx.Post, it always uses the running thread ID and not the one I want to marshal to. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1514256" width="1" height="1"&gt;</description></item><item><title>re: StackTrace and StackFrame</title><link>http://msmvps.com/blogs/manoj/archive/2004/03/25/StackTrace-and-StackFrame.aspx#1467314</link><pubDate>Thu, 17 Jan 2008 10:22:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1467314</guid><dc:creator>Jeremy</dc:creator><description>&lt;p&gt;Hello, &lt;/p&gt;
&lt;p&gt;i&amp;#39;m trying to do something like this, and i want to acces to the argument&amp;#39;s instance of the invoked method.&lt;/p&gt;
&lt;p&gt;I can access to the metadata (Type, Name) but i can&amp;#39;t access to the value when the method is invoked.&lt;/p&gt;
&lt;p&gt;How to do this ?&lt;/p&gt;
&lt;p&gt;(Sorry for langage i&amp;#39;m not english :P)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1467314" width="1" height="1"&gt;</description></item><item><title>Threading in .Net 2.0</title><link>http://msmvps.com/blogs/manoj/archive/2005/11/03/74120.aspx#1464245</link><pubDate>Tue, 15 Jan 2008 13:04:35 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1464245</guid><dc:creator>Threading in .Net 2.0</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Threading in .Net 2.0&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1464245" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1450550</link><pubDate>Wed, 09 Jan 2008 18:23:02 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1450550</guid><dc:creator>Rohit</dc:creator><description>&lt;p&gt;Does any one know a way in which the new process just created can be debugged (in Visual studio) ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1450550" width="1" height="1"&gt;</description></item><item><title>re: InternalsVisibleToAttribute - Friend Assemblies</title><link>http://msmvps.com/blogs/manoj/archive/2005/09/26/67999.aspx#1441931</link><pubDate>Sun, 06 Jan 2008 18:51:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1441931</guid><dc:creator>Keith</dc:creator><description>&lt;p&gt;[assembly:InternalsVisibleToAttribute(&amp;quot;MyFriendAssembly, PublicKeyToken=45cb56a45e0a69a1&amp;quot;)]&lt;/p&gt;
&lt;p&gt;You cannot use PublicKeyToken with a signed assembly&lt;/p&gt;
&lt;p&gt;you need to use public key. &lt;/p&gt;
&lt;p&gt;Keith&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1441931" width="1" height="1"&gt;</description></item><item><title>re: Something IsMissing - A Short Story</title><link>http://msmvps.com/blogs/manoj/archive/2004/01/27/2114.aspx#1410148</link><pubDate>Fri, 21 Dec 2007 18:08:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1410148</guid><dc:creator>Darrin</dc:creator><description>&lt;p&gt;This article&amp;#39;s attitude is indicative of the overall contempt that C/C++/C# developers had for VB6, even though it filled a need for quick business application development. (where requirements change constantly... hello, real world)&lt;/p&gt;
&lt;p&gt;Thus, we ended up with lack of path from VB6 to VB.NET, all because a bunch of eggheads at Microsoft thought they new better than the marketplace!&lt;/p&gt;
&lt;p&gt;E.g. Optional parameters&lt;/p&gt;
&lt;p&gt;Ok, its somehow better that I write a dozen overloaded methods when a single method with Optional parameters would&amp;#39;ve done... VB.NET creates the overloads behind the scenes for you.&lt;/p&gt;
&lt;p&gt;Why do you C# guys like writing so much code? &amp;nbsp;I can&amp;#39;t figure it out?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1410148" width="1" height="1"&gt;</description></item><item><title>re: String.Format: A Simple Tip</title><link>http://msmvps.com/blogs/manoj/archive/2004/09/29/String.Format_3A00_-A-Simple-Tip.aspx#1405169</link><pubDate>Wed, 19 Dec 2007 11:05:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1405169</guid><dc:creator>Laoujin</dc:creator><description>&lt;p&gt;You could just use string concatenation you just have to be careful to escape any possible attacks.&lt;/p&gt;
&lt;p&gt;string.Format(&amp;quot;SELECT * FROM table WHERE field=&amp;#39;{0}&amp;#39;&amp;quot;, userInput.Replace(&amp;quot;&amp;#39;&amp;quot;, &amp;quot;&amp;#39;&amp;#39;&amp;quot;))&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sure there are better methods then the Replace in .NET but that would be perfectly save.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1405169" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1278523</link><pubDate>Fri, 02 Nov 2007 15:52:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1278523</guid><dc:creator>Zeina</dc:creator><description>&lt;p&gt;Dear,&lt;/p&gt;
&lt;p&gt;I have a batch file that runs Adobe.exe application. Executing this batch file from a Windows Application worked fine and the output of the Batch successfully achieved whereas the same code called from an ASP.NET application doesn’t work. The exe is displayed in the Task Manager but doesn’t execute the code it should and the user runing this service is the Administrator.&lt;/p&gt;
&lt;p&gt;Apparently it is a security issue sine the problem occurs when hosting the application in IIS but I have tried working with all the permissions and it didn’t work. The Identity of the pool of the web site is Configurable with the System Administrator Credentials.&lt;/p&gt;
&lt;p&gt;Many have the same problem but none has listed the solution. This is very urgent, so pleaseeeeeeeeeeeee help :(&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Zeina&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1278523" width="1" height="1"&gt;</description></item><item><title>re: Me, MyBase and MyClass...</title><link>http://msmvps.com/blogs/manoj/archive/2004/01/29/2175.aspx#1275573</link><pubDate>Wed, 31 Oct 2007 14:56:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1275573</guid><dc:creator>Wei</dc:creator><description>&lt;p&gt;Nice to read that.. &amp;nbsp;I was confused about mybase and myclass. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1275573" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1248548</link><pubDate>Wed, 17 Oct 2007 06:30:11 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1248548</guid><dc:creator>Neeraj</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have the ollowing code running for runing a console application:&lt;/p&gt;
&lt;p&gt;Process myProcess = new Process();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ProcessStartInfo info = new ProcessStartInfo(appName);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.StartInfo = info;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.StartInfo.UseShellExecute = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.StartInfo.RedirectStandardOutput = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.StartInfo.RedirectStandardInput = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.Start();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myProcess.WaitForExit();&lt;/p&gt;
&lt;p&gt;Here I am passing the names of different console applications in the ProcessStartInfo.&lt;/p&gt;
&lt;p&gt;My Problem is that the console application starts, but within a second closes, though when I run this application as a standalone, it runs properly.&lt;/p&gt;
&lt;p&gt;Please Help somebody&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1248548" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#1228588</link><pubDate>Wed, 03 Oct 2007 14:16:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1228588</guid><dc:creator>Sloan</dc:creator><description>&lt;p&gt;//Quote//&lt;/p&gt;
&lt;p&gt;I am using the same code and created windows services in my local system but if i run my windows service to receive the message. Access denaid the &amp;nbsp;error message i got.&lt;/p&gt;
&lt;p&gt;Can u specify the the format name for the Queue Path. Or any security setting has to be enabled.&lt;/p&gt;
&lt;p&gt;//End Quote&lt;/p&gt;
&lt;p&gt;You have to go thru &amp;quot;Manage Computer&amp;quot; and find the Queue. &amp;nbsp;And give permissions ON THE QUEUE...to the &amp;quot;SYSTEM&amp;quot; account (the SYSTEM account local to that computer).&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t have to do &amp;quot;Full Control&amp;quot;, but Send/Receive are necessary. &amp;nbsp;I usually give Get/Set Permissions as well.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1228588" width="1" height="1"&gt;</description></item><item><title>re: Tip: StrongNameIdentityPermission </title><link>http://msmvps.com/blogs/manoj/archive/2004/10/20/16208.aspx#1222491</link><pubDate>Sun, 30 Sep 2007 07:14:49 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1222491</guid><dc:creator>Roiy zysman</dc:creator><description>&lt;p&gt;SNIP is not always the best way to protect your code.&lt;/p&gt;
&lt;p&gt;Check out this article&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/ptorr/archive/2004/07/26/196590.aspx"&gt;blogs.msdn.com/.../196590.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Roiy&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1222491" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1216644</link><pubDate>Wed, 26 Sep 2007 11:37:11 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1216644</guid><dc:creator>roberto</dc:creator><description>&lt;p&gt;I have a problem with windows service. When i run Process.Start(&amp;quot;iexplore.exe&amp;quot;), i cant open a iexplore window but the i see the process running in task manager. This services running under windows server 2003, and have checked Interact with Desktop, but doesnt work. My email is roberto@t2o.es . If someone can help me, send me a email please. Thank you for you colaboration.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1216644" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1138567</link><pubDate>Sun, 26 Aug 2007 11:34:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1138567</guid><dc:creator>kamran</dc:creator><description>&lt;p&gt;winservice starts the process (Application) but does not bring it to interface. i ve checked Interact with desktop&lt;/p&gt;
&lt;p&gt;but doesn&amp;#39;t work&lt;/p&gt;
&lt;p&gt;using win-XP&lt;/p&gt;
&lt;p&gt;VS-2003&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1138567" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#1094439</link><pubDate>Wed, 08 Aug 2007 01:55:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1094439</guid><dc:creator>JM</dc:creator><description>&lt;p&gt;I worte a Q listener as a window service, it is working for read the local transactional Q. But when I cluster the MSMQ, the Q listenser service can not read the Q any more.&lt;/p&gt;
&lt;p&gt;any idea why?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1094439" width="1" height="1"&gt;</description></item><item><title>re: Me, MyBase and MyClass...</title><link>http://msmvps.com/blogs/manoj/archive/2004/01/29/2175.aspx#1058074</link><pubDate>Thu, 26 Jul 2007 07:43:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1058074</guid><dc:creator>VIRAJ</dc:creator><description>&lt;p&gt;It&amp;#39;s a really nice explanation to the point. Thnks in advance&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;VIRAJ&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1058074" width="1" height="1"&gt;</description></item><item><title>re: Process.Start() Quips</title><link>http://msmvps.com/blogs/manoj/archive/2004/10/23/16505.aspx#1043384</link><pubDate>Fri, 20 Jul 2007 14:37:32 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1043384</guid><dc:creator>Dave</dc:creator><description>&lt;p&gt;In a response to Ken, and also to fix the issue, I would like to know why I have to tick and untick the Interact checkbox to make it work. (The code does make it ticked but as no effect).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also noticed other ControlSet in the registry, &lt;/p&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MYSERVICE &lt;/p&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\MYSERVICE&lt;/p&gt;
&lt;p&gt;Should I change the value for these also. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Why do I need to go under services and untick, tick again, apply to make it work ???&lt;/p&gt;
&lt;p&gt;floyd us 27 a t hotmail d o t com&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1043384" width="1" height="1"&gt;</description></item><item><title>re: A simple MSMQ Listener helper class</title><link>http://msmvps.com/blogs/manoj/archive/2005/10/16/70979.aspx#941210</link><pubDate>Mon, 04 Jun 2007 02:08:13 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:941210</guid><dc:creator>Filip</dc:creator><description>Nice code, would you be able to provide an example of the test class as well on how to call this? (Sorry, I&amp;#39;m a c# beginner)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=941210" width="1" height="1"&gt;</description></item></channel></rss>