tag:blogger.com,1999:blog-86246296238433676852024-02-20T06:43:42.914-05:00really rrraeasp.net, whateverMisty McKinleyhttp://www.blogger.com/profile/13816431383387056911noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8624629623843367685.post-66255243592445037742008-06-14T12:22:00.002-04:002008-06-14T12:25:59.513-04:00Resolving Asp.Net EventID 1334If you are seeing Event ID 1334, with a similar message:<br /><br /><blockquote>Failed to initialize the AppDomain:/LM/W3SVC/99999999/Root<br /><br />Exception:<br />System.IO.FileLoadException<br /><br />Message: Could not load file or assembly<br />'System.Web, Version=2.0.0.0,<br />Culture=neutral,<br />PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.<br />Access is<br />denied.<br />StackTrace: at<br />System.Reflection.Assembly._nLoad(AssemblyName<br />fileName, String codeBase,<br />Evidence assemblySecurity, Assembly locationHint,<br />StackCrawlMark& stackMark,<br />Boolean throwOnFileNotFound, Boolean<br />forIntrospection)<br />at<br />System.Reflection.Assembly.nLoad(AssemblyName<br />fileName, String codeBase,<br />Evidence assemblySecurity, Assembly locationHint,<br />StackCrawlMark& stackMark,<br />Boolean throwOnFileNotFound, Boolean<br />forIntrospection)<br />at<br />System.Reflection.Assembly.InternalLoad(AssemblyName<br />assemblyRef, Evidence<br />assemblySecurity, StackCrawlMark& stackMark,<br />Boolean forIntrospection)<br />at<br />System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence<br />assemblySecurity, StackCrawlMark& stackMark, Boolean<br />forIntrospection)<br />at<br />System.Activator.CreateInstance(String assemblyName,<br />String typeName, Boolean<br />ignoreCase, BindingFlags bindingAttr, Binder<br />binder, Object[] args, CultureInfo<br />culture, Object[] activationAttributes,<br />Evidence securityInfo,<br />StackCrawlMark& stackMark)<br />at<br />System.Activator.CreateInstance(String<br />assemblyName, String typeName)<br />at<br />System.AppDomain.CreateInstance(String<br />assemblyName, String typeName)<br />at<br />System.AppDomain.CreateInstance(String<br />assemblyName, String typeName)<br />at<br />System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String<br />appId, IApplicationHost appHost, HostingEnvironmentParameters<br />hostingParameters)<br />at<br />System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String<br />appId, IApplicationHost appHost, HostingEnvironmentParameters<br />hostingParameters)</blockquote><br />Make sure that you have added the proper accounts with File System permissions to your web folder. On Windows 2003 with IIS6, these should be (for a default setup): Network Services (Make sure it is Network Services and not just Network), ASPNET, IUSR_<machinename> and IWAM_<machinename>.Misty McKinleyhttp://www.blogger.com/profile/13816431383387056911noreply@blogger.com1tag:blogger.com,1999:blog-8624629623843367685.post-45788759901288101712008-06-13T21:21:00.002-04:002008-06-13T21:27:11.880-04:00Asp.Net - Add Attributes to RadioButtons (Finally)This was shockingly simple in VS2008 targeting .Net 3.5, compared to how shockingly complicated it used to be.<br /><br />Dim oRad As New RadioButton<br />oRad.InputAttributes.Add("myattribute", "myattributevalue")<br /><br />Does it get any easier than that???Misty McKinleyhttp://www.blogger.com/profile/13816431383387056911noreply@blogger.com0tag:blogger.com,1999:blog-8624629623843367685.post-72850498543777015002008-04-28T10:31:00.003-04:002008-04-28T11:01:00.073-04:00Protect Your Scalar Functions in Strongly-Typed DataSetsHow many times have you created a modified insert statement in a strongly-typed <span class="blsp-spelling-error" id="SPELLING_ERROR_0">dataset</span> that returns the new primary key value of the inserted record using, for example:<br /><br /><blockquote><p><span style="font-family:courier new;">INSERT INTO [table] (col) VALUES (@col);<br />SELECT SCOPE_IDENTITY();</span></p></blockquote><br />After you create the query, you mark the execute mode as scalar so that you can get the value back out, only to find the next time you modify that table adapter, the query loses its execute mode and reverts back to Non-Query (the default execute mode for Insert queries). All of the sudden your post-insert logic is doing all sorts of baffling things related to the first record in the table, or worse, no record.<br /><br />It seems that Visual Studio is supposed to mark the query when you modify it so that future updates don't overwrite your customizations, but unless I am absolutely stupid, this never works.<br /><br />Thwart the behavior by doing something so illogical that it must work.<br />When using the Add Query wizard on the table adapter<br /><ol><li>Select "Use <span class="blsp-spelling-error" id="SPELLING_ERROR_1">SQL</span> statements", click Next.</li><li>Select the Insert option (if you want to get a base insert statement for your self, copy the query into your clipboard, go previous and change your query type to "SELECT which returns a single value")<br /><strong>- OR - </strong><br />Select the "SELECT which returns a single value" (if you have your query and don't mind typing it)<br />and of course, click Next.</li><li>Enter your query, click Next.</li><li>Name your query, click Next.</li><li>Oh! the horror. The wizard is throwing a warning message: Failed to get schema for this query. Should we halt, go back, rack our brains for hours trying to determine the best course of action to resolve this tragic error? Of course not. If you are reasonably certain that the query you just pasted or typed into the field is correct, apply your settings and click Finish. You will be rewarded with what should be a table adapter update-proof insert statement that NEVER loses its scalar execution mode. <strong>NEVER!</strong></li></ol>Misty McKinleyhttp://www.blogger.com/profile/13816431383387056911noreply@blogger.com0tag:blogger.com,1999:blog-8624629623843367685.post-11355890409717970572008-04-25T21:32:00.003-04:002008-04-25T21:53:59.151-04:00For Frequent Hosts File UpdatersIf you find yourself constantly modifying your hosts file, and are always irritated about the incessant need to choose the program to edit the file with, try this:<br /><br /><ol><li>Create a short-cut to your hosts file on your desktop (or wherever).</li><br /><li>Right click the hosts file and select properties.</li><br /><li>Change the target to something like:<br /><blockquote><p>notepad c:\windows\system32\drivers\etc\hosts</p><p>or, in my case, since <a href="http://www.editplus.com/">editplus</a> is the best text editor ever:</p><p>"C:\Program Files\EditPlus 3\editplus.exe" c:\windows\system32\drivers\etc\hosts</p></blockquote></li><li>Click OK.</li></ol><br /><p>That's it. You're done. Now whenever you want to make a change, just click your shortcut and the hosts file will magically open, ready for editing.</p><br /><ol><br /><br /></ol>Misty McKinleyhttp://www.blogger.com/profile/13816431383387056911noreply@blogger.com0