James Nearn
Christian, husband, father, geek.
NotImplementedException because of missing Microsoft.SqlServer.Types.dll in SQL 2012.txt
While on a project for work, I ran into an exception for .PointCount which I obviously can't publish here, but I moved it to a sandbox Azure function app and this is the error I had:

Microsoft.Azure.WebJobs.Host.FunctionInvocationException :

Exception while executing function: Function1 ---> System.NotImplementedException : The method or operation is not implemented.
at System.Data.Spatial.DefaultSpatialServices.GeographyPolygonFromText(String geographyText,Int32 spatialReferenceSystemId)
at System.Data.Spatial.DbGeography.PolygonFromText(String polygonWellKnownText,Int32 coordinateSystemId)
at async FunctionApp1.Function1.Run(HttpRequestMessage req,TraceWriter log)

at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) End of inner exception
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)
at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()
at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)
at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary`2 arguments,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.Host.FunctionRequestInvoker.ProcessRequestAsync(HttpRequestMessage request,CancellationToken cancellationToken,WebScriptHostManager scriptHostManager,WebHookReceiverManager webHookReceiverManager)
at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.b__0(??)
at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)
at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)

My friend / co-worker Mikal Grant discovered link to SQL EF dependency

Troubleshooting started with isolating the code to a new function app to check if it was a problem with implementation.

The same code worked on machines for two other coworkers, so it must be my machine.
Perhaps it was my data, but generic data caused the exception.
Perhaps it was the way the Azure SDK was configured on my machine? All the SDK versions matched.
Moving the sample code to a console app confirmed it wasn't an Azure SDK issue.
With Procmon I discovered searches for Microsoft.SqlServer.Types.dll in c:\windows\assembly and noticed there was a v15, v14, v13, v12 there but not v11 (which is SQL 2012).

It appears that SQL 2012 itself isn't needed. The SQL 2012 feature pack provides CLR types, which is enough.

Further research confirms:
SQL 2012 installs this dll too, SQL 2014 don't! You have to install the Microsoft System CLR Types for SQL Server 2008 R2 on the machine.


Thinking the latest SQL 2012 SP3 would be smart, I discovered that was a problem also.

I uninstalled SP3 and installed 2012 SP1 feature pack. All is well.

Message Templates for logging
2019-02-22 04:22 PM

Use `@` in the `messageTemplate` of a `Serilog.ILogger` method to serialize the parameters into JSON!


Application Insights - missing Cloud role name and prop__MS_FunctionName
2019-02-07 03:48 PM

It seems the Cloud_RoleName and prop__MS_FunctionName values are not available in Application Insights when debugging a Function App locally. It turns out that is normal behavior out of the box:

In web applications, Cloud_RoleName is a value of an environment variable WEBSITE_SITE_NAME which is set automatically when hosted in Azure.
For on-premises you can set this variable manually.
For debugging environment variables can be set in Project settings > Debug > Environment variables (example).

The WebJobs SDK doesn't support the following Azure Functions features:

FunctionName attribute
HTTP trigger
Durable Functions HTTP management API
FunctionName attribute
In a WebJobs SDK project, the method name of a function is the function name. The FunctionName attribute is used only in Azure Functions.

Null Conditional Operator combined with Nullable
2019-01-09 03:19 PM

Wow... been a while since I wrote something! lol... but... here we go...
Quick lesson learned about the Null Conditional Operator combined with Nullable - they work REALLY well together! Consider this code:

DateTime? d = DateTime.Now;
Console.WriteLine($"Nullable with a value: {d}\n\n");
Console.WriteLine($"Calling a method on the d.Value when it's not null works: {d.Value.ToLocalTime()}\n\n");

d = null;
Console.WriteLine($"Nullable with a null value: {d} <-- nothing, doesn't fail!\n\n");

// This will generate an exception: [System.InvalidOperationException: Nullable object must have a value.]
Console.WriteLine("Calling a method on the d.Value when it is null fails: " + d.Value.ToLocalTime() + "\n\n");
catch (Exception ex)
Console.WriteLine("Calling a method on the null d.Value fails.");
Console.WriteLine("Here is the exception: " + ex.ToString() + "\n\n");

Console.WriteLine("Calling a method on the d.Value when it is null fails: "
+ (d.HasValue ? d.Value.ToLocalTime() : (DateTime?) null) + "\n\n"

Console.WriteLine("Calling a method on the d.Value using conditional null operator is cleaner: "
+ d?.ToLocalTime());

Collection of LDAP properties
Use this to get a quick collection of LDAP properties
public PropertyCollection GetLdapProperties(WindowsIdentity id)
  string path = string.Format("LDAP://", id.User);
  DirectoryEntry user = new DirectoryEntry(path, null, null, AuthenticationTypes.Secure);
  return user.Properties;
AjaxControlToolkit Editor is blank
AjaxControlToolkit Editor is blank
It looks empty like this:

After a lot of searching, I found my solution to the same problem... use this:
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>

instead of:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

Good luck!

This would allow use of the Editor control, rather than extending the Textbox (which I actually like that method as well).

Confirmed as an answer at:

.NET Regex - using $ and \r\n
2013-10-09 12:21 PM
I have a list of values in a textbox...

In a textbox it looks like this:
TextBox1.Text = "apple\r\nbanana\r\ncherry\r\ndonut\r\n";

Let's parse through the list using a regex pattern and do a replace...
TextBox1.Text = Regex.Replace(TextBox1.Text, "^(.*)$" , "I like to put $1 on my plate.\r\n", RegexOptions.Multiline);

I would expect to see this:
I like to put apple on my plate.
I like to put banana on my plate.
I like to put cherry on my plate.
I like to put donut on my plate.

Instead, I see this:
I like to put apple
on my plate.
I like to put banana
on my plate.
I like to put cherry
on my plate.
I like to put donut
on my plate.

It turns out that $ is matching \n, but not \r.

Change to this and it worked as expected:
TextBox1.Text = Regex.Replace(TextBox1.Text, "^(.*)\r\n" , "I like to put $1 on my plate.\r\n", RegexOptions.Multiline);
AjaxToolkit Editor Blue Divs
2013-07-16 04:15 PM
Notice each line has a blue dashed border:

Notice the WebResource.axd has a style on DIV itself (the tag, not a class or ID) of border-xxx: #0000ff 1px dashed

F12 shows there are only embedded CSS links used...

Dig around in the source code and found DesignPanel.css which is an embedded resource and delivered through WebResource.axd

Source code shows that it will return a local file if the property is set on the control

So the fix... Create a local file and set the property to be that local file!  

UpdatePanel doesn't like the ViewState being tampered with!
2013-12-24 08:24 PM
Previous instances of RadAjaxPanel were replaced with UpdatePanel. Suddenly, controls within that page no longer postback.

Sample Code:
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />

protected void Button1_Click(object sender, EventArgs e)
  Button1.Text = DateTime.Now.ToString();

protected void Button2_Click(object sender, EventArgs e)
  Button2.Text = DateTime.Now.ToString();

When alternating clicks between Button1 and Button2, I would expect that the clicked button would update with the current time. Instead, the button values were clearing.

It turns out this was specific to a certain page. On a normal page, it worked fine. On the page with these symptoms, I discovered it was related to a solution that implimented due to a large ViewState. I was overriding SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium and that was causing the UpdatePanel to fail when saving the ViewState information to the Cache.
Can't publish files in Visual Studio 2012
2013-01-24 08:13 PM
When publishing files to a local drive with Visual Studio 2012, there seems to be no files in the destination directory.
- The My Project folder has some read-only .pubxml files that contain settings for publishing. Deleting them seems to make deploying work again.
- After a Get Latest from TFS, my previously successful Publish settings are overridden with another team member's settings.

When publishing a project, give the profile name something unique like your own name. This will make a seperate .pubxml file with your settings. Other team members using unique profiles with their own names should no longer affect your settings. When they change their profile settings, their .pubxml file will be checked out and updated accordingly.
Not receiving MMS w/ ting on my Samsung SIII
2012-11-23 12:10 PM
People did not receive pictures we sent and we did not receive pictures that they sent.

Pam using a Samsung Galaxy SIII, stock rom, rooted, but without the latest patch.
James using a Samsung Galaxy SIII, CM10 rom, using cm-10-20121118-NIGHTLY

Pam's phone:
- dial ##DATA#
- select Edit
- enter MSL (obtain from ting)
- select Others
- select MMSC URL
- change from http://mms.sprintpcs.com to http://mms.plspictures.com
- save and reboot

James's phone:
It seems there was no obvious way to natively edit the MMS setting with CM10. Various sources indicated I needed to edit a file. To make things easier, I installed DropBear SSH server.
SSH in, then remount the file system:
root@android:/ # cd /system/etc
root@android:/system/etc # mount -o rw,remount /system
Using vi, I altered /system/etc/apns-conf.xml to replace references for mms.sprintpcs.com to be mms.plspictures.com
Rebooted, MMS now works. Reboot may not have been necessary even.
Getting the Repeater row index from the LinkButton
2012-10-03 06:08 AM
This is one I am posting for my own reference so I can find it easier... When Clicking a LinkButton in a Repeater, I needed the index available to modify a cached DataTable.

Getting the Repeater row index from the LinkButton

LinkButton lnkButton = sender as LinkButton;
int RepeaterItemIndex = ((RepeaterItem)lnkButton.NamingContainer).ItemIndex;

Credit to kaushalparik27 at http://forums.asp.net/t/1333400.aspx/1
Scroll after postback
2012-10-02 01:39 PM
Button inside of a GridView fires the Command event and needs to scroll to the bottom of the page.

Use an anchor tag, then use ClientScript.RegisterStartupScript on the end of the event method to scroll to it.

Credit goes to http://forums.asp.net/t/1311972.aspx/1
SQL string splitter
2012-08-13 1:02 PM
I really prefer to give credit for these types of things, but I don't remember where I found it :(

Basic syntax...
select dbo.FN_STRING_HELPER_SPLIT('My name is James', ' ', 4)
will return

@strToSplit as varchar(4000),
@delimiter as varchar(50),
@columnToReturn as int
RETURNS varchar(25)
-- Declartion of the return variable
DECLARE @i as int
DECLARE @occurrences as int
DECLARE @delimiterIndex as int
DECLARE @actSplitValue as varchar(4000)

-- T-SQL statements to compute the return value here
SET @i = 1
SET @delimiterIndex = 1

WHILE @i <= @columnToReturn
SET @delimiterIndex = CHARINDEX(@delimiter, @strToSplit)
-- if not found end while
SET @actSplitValue = @strToSplit
IF @delimiterIndex = 0 BEGIN
SET @actSplitValue = LEFT(@strToSplit, @delimiterIndex - 1)
-- SUBSTRING(string, von, bis)
SET @strToSplit = SUBSTRING(@strToSplit ,@delimiterIndex +1, LEN(@strToSplit)- @delimiterIndex)
SET @i = @i + 1
-- the result of the function
RETURN @actSplitValue
Rendering a UserControl as string
2012-05-25 06:57 AM
I was given the task of creating an HTML based email that sent the contents of a webform. This is where I explored the possibility of rendering an independant usercontrol into a string.

I did some searching and came across code like this:
Page pageHolder = new Page();
PrintVersion pv1 = (PrintVersion)pageHolder.LoadControl("PrintVersion.ascx");

StringWriter output = new StringWriter();
HttpContext.Current.Server.Execute(pageHolder, output, false);
return output.ToString();

I was getting errors like:
System.Web.HttpException: Error executing child request for handler System.Web.UI.Page'.
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.
System.Web.HttpException: Control 'ctl00_listItems' of type 'Repeater' must be placed inside a form tag with runat=server.

I stumbled on this article:

It suggested overriding a method (notice no call to the base method)
public class PageOverride : System.Web.UI.Page
  public override void VerifyRenderingInServerForm(System.Web.UI.Control control) {}

Worked perfectly!
Panel with a Visible property that won't update
2012-05-09 07:18 AM
What's wrong with this pseudo-code?
Panel p = gridItems.Rows[0].FindControl("pnlHiddenByDefault");
//do some other random stuff
//do more random stuff
p.Visible = true; //FAIL
The code will execute fine but even after setting the Visible property to true, a QuickWatch will show the property is still false.

Panel p = gridItems.Rows[0].FindControl("pnlHiddenByDefault");
//do some other random stuff
//do more random stuff
//get fresh reference after DataBind
p = gridItems.Rows[0].FindControl("pnlHiddenByDefault");

p.Visible = true; //WIN

using SqlDataSource in code
2012-02-17 12:35 PM
Sometimes there is a need to use a SqlDataSource object in the code...
<asp:SqlDataSource ID="sqlSelectUsers" runat="server"
  ConnectionString="<%$ConnectionStrings:MainConnectionString %>"
  ProviderName="<%$ ConnectionStrings:MainConnectionString.ProviderName %>"

    <asp:Parameter Name="RequestingUserID" Type="Int16" />

sqlSelectUsers.SelectParameters("RequestingUserID").DefaultValue = 2 //hard coded value for demo purposes
Dim dv As DataView = sqlSelectUsers.Select(DataSourceSelectArguments.Empty)
Dim dt As DataTable = dv.ToTable()

This will result in a DataTable for manual consumption.

Another way to parse CSV parameters for values not necessarily in a table
2012-02-17 10:29 AM

-- http://www.projectdmx.com/tsql/tblnumbers.aspx

-- http://www.projectdmx.com/tsql/sqlarrays.aspx

SELECT SUBSTRING( ',' + @p + ',', n + 1, CHARINDEX( ',', ',' + @p + ',', n + 1 ) - n - 1 ) AS "value"
WHERE SUBSTRING( ',' + @p + ',', n, 1 ) = ',' AND n < LEN( ',' + @p + ',' ) ;

drop table Nbrs

Convert a SQL CSV Parameter into a table
2012--2-16 12:25 PM
Consider the need to pass in a CSV parameter like this:
SET @UserIDs_CSV = '1,2,4,5,8,9'

If that CSV parameter happens to correlate to a table, like in this case, Users... Use a query like this to convert the CSV parameter into a temp table...
into #SelectedUserIDs
FROM Users
',' + cast(UserID as varchar(10)) + ',',
',' + @UserIDs_CSV + ','
) > 0

So now just use the temp table as you need for future queries...
select * from #SelectedUserIDs

Credit goes to http://www.projectdmx.com/tsql/sqlarrays.aspx
Getting a quicker SQL row count
2012-02-06 11:29 AM
Credit goes to Rick Caminiti at http://rickcaminiti.com/tips/alternative-efficient-tables-rowcount-sql/

SELECT COUNT(*) statements make a full table scans to return the total table's row count, it can take a lot of time and a lot of "energy" for a large table.
There is another way to determine the total row count in a table by using the sysindexes system table. There is a column (ROWS) in it that contains the total row count for each table in your database.
You can use the syntax below to speed up the query by several times. You can see this by setting statistics on, as shown below.

SELECT count(*) FROM tbTest
SELECT rows FROM sysindexes WHERE id = OBJECT_ID('tbTest') AND indid < 2

I tried my own test, and here are my results:

(1 row(s) affected)
Table 'myTable'. Scan count 1, logical reads 116, physical reads 1, read-ahead reads 176, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

(1 row(s) affected)
Table 'sysidxstats'. Scan count 1, logical reads 5, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Reset Windows Media Player 12 To Default Settings
2011-12-21 09:52 AM
Here's a cool trick that allows you to reset WMP12 back to it's default settings. This might be handy if you are encountering any issues of your own.

Simply to go Start > Run (or hold down the Windows Key and press R) and type in the following:
msdt.exe -id WindowsMediaPlayerConfigurationDiagnostic

Press enter and follow the prompts to reset WMP.

Credit goes to Ben: http://daily-grind.net/reset-windows-media-player-12-to-default-settings/

SQL example for updating children records from a parent record
2011-12-08 09:01 AM
I just ran into this again, and I know I have had to do this several times before but it gets old having to look up such an activity that I may only do twice a year.

The scenario... There are four records:
ID=123, ParentID=null, Name="Bob"
ID=1000, ParentID=123, Name="Bob"
ID=1001, ParentID=123, Name="Bob"
ID=1002, ParentID=123, Name="Bob"

The requirement is to update Name="Joe" where ID=123, and then cascade the changes to the children records.

This could be done easily w/ the same proc that updates the parent, however in my situation that proc is being shared, so my solution is to make a new query that fetches the right info w/ a join and then updates:
UPDATE target
  Field1 = source.Field1, --notice this is not children.Field1 = source.Field1
  Field2 = source.Field2,
  Field3 = source.Field3
from ExampleTable target
inner join ExampleTable source on source.ID = target.ParentID
WHERE target.ParentID = @ParentID
Clear the "must change password" checkbox for new SQL users.
2011-10-03 12:27 AM
It's very annoying to create a new SQL user and forget to clear the "User must change password at next login" checkbox.

This will result in an error message:
Login failed for user 'login_name'. Reason: The password of the account must be changed.

If you try to clear the message, you get:
The CHECK_POLICY and CHECK_EXPIRATION options cannot be turned OFF when MUST_CHANGE is ON. (Microsoft SQL Server, Error: 15128)

One solution is to delete the user and create again, and clear the checkbox. Another solution I found on Experts Exchange:

Then you can uncheck 'Enforce password policy' and 'Enforce password expiration' or just run the following two sql commands:


Word 2007 document with comments is crashing
2011-09-12 09:44 AM
My coworker had a document that had around 30 comments and when she'd click on the comment to delete it, Word 2007 would crash. She mentioned that the comment targets somehow were erased and the comments were orphaned but still in the document.

Word has a recovery mode that did not work. I tried copy/pasting to a new document which did not work. Even tried using a VBA macro to delete a comment, then altered it to select and delete these other comments. That didn't work either.

I know Word 2007 uses the new .docx format, which is really just a zip file container. So I unzipped the .docx file, dug around in the supporting XML files, and found two files. There is a document.xml and a comments.xml and inside the comments.xml file is an ID in each node that the document.xml file references. Pretty simple layout.

In the document.xml file, I searched for "w:comment" and found hits on nodes named
<w:commentRangeStart w:id="3" />
<w:commentRangeEnd w:id="3"/>
<w:commentReference w:id="3"/>

Those nodes match the comments.xml document that has
<w:comment w:id="3">

Furthermore, while searching through the document.xml file, the IDs for problematic comments just happened to have
<w:commentReference w:id="3"/>
but not
<w:commentRangeStart w:id="3" />
<w:commentRangeEnd w:id="3"/>
So... Remove the broken references in document.xml and now there are fully orphaned items in comments.xml so remove those nodes as well. Save all docs, then rezip the folder and rename to .docx

The doc opens fine, and Word 2007 no longer crashes :) Woohoo.
Ensure deploys are not in debug mode
2011-09-01 07:58 AM
The <deployment retail="true"/> Switch in Machine.config

If you are a server administrator and want to ensure that no one accidentally deploys an ASP.NET application in production with the <compilation debug="true"/>switch enabled within the application's web.config file, one trick you can use with ASP.NET V2.0 is to take advantage of the <deployment> section within your machine.config file.

Specifically, by setting this within your machine.config file:
<deployment retail="true"/>

You will disable the <compilation debug="true"/> switch, disable the ability to output trace output in a page, and turn off the ability to show detailed error messages remotely. Note that these last two items are security best practices you really want to follow (otherwise hackers can learn a lot more about the internals of your application than you should show them).

Setting this switch to true is probably a best practice that any company with formal production servers should follow to ensure that an application always runs with the best possible performance and no security information leakages. There isn't a ton of documentation on this switch - but you can learn a little more about it here.

Credit goes to http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx

WebResource.axd returns 404 and then starts working after a while on it's own
2011-08-30 07:32 PM
Original question that I posted:
We have a library of common controls, and I'm attempting to steer towards using embedded resources in it for images, JS, and CSS. It seems that upon each deploy to TEST/PROD, there is a window of time where WebResource.axd is returning a 404. After that window of time expires, suddenly the page starts serving out content properly. On my local DEV machine it seems that there are times when I can compile and reload a page that is using embedded resources, and it immediately shows a difference. Other times it responds like there is a cache waiting to expire.
Things I've tried:
- browsing from different machines to rule out local caching
- iisreset
- net stop w3svc
- delete temp files from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files and C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
- killing the inetinfo.exe process
- killing the w3wp.exe process
- disabling IIS Output Caching
- copying the URL and adding in an extra false querystring parameter to mimic a new page request
- pressing Ctrl-F5 :)
It seems rebooting fixes the issue.
My google kung-fu has diluted results filled with everyone's answer to check the namespace. I am confident the namespace is correct. After a while the resource will start serving out properly and the correct version. And if it DOES serve at some point, it seems logical to me that the namespace must be correct.
Any ideas? What other information can I provide?
Michigan, USA

OK, WOW... FINALLY stumbled a solution. Ready? This is going to be a long one :) While trying to get more information, I load Fiddler and I'm looking at the headers... when I come across
this standard .NET error (edited):
<title>The resource cannot be found.</title>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>The resource cannot be found.</i> </h2></span>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
[HttpException]: This is an invalid webresource request.
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages
using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors
mode="RemoteOnly"/> in production environments.-->

WHOA... there's a commented stack trace that is buried in the page?!?! After a quick Google search and I come across this:
Believe it or not, if your dlls have embedded resources in them, and they are dated in the future this will happen (if you ever compile dlls in the UK and then immediately deploy them to US web servers you'll be well aware of this issue!). I can't remember the event log error this shows, but would know if I saw it - and it is not immediately obvious.

- Rob Levine (http://stackoverflow.com/users/134754/rob-levine)
at http://stackoverflow.com/questions/1096793/system-web-httpexception-this-is-an-invalid-script-resource-request

That is exactly the situation... I compile in Eastern Time, then deploy to Rackspace in Central Time. After about an hour the resources begin to load again... it makes sense... the time stamps catch up!
Visual Studio design view error with controls
2011-07-17 07:18 PM
I kept getting this error in the design view:
The page has one or more <asp:Content> controls that do not correspond with <asp:ContentPlaceHolder> controls in the Master Page.

A few Google searches, this is what I found to work for me:
The problem was solved by using this:

instead of this:
<title />

Skype in the Windows 7 taskbar
2011-07-01 08:58 PM
Try searching Google to see how to get rid of the Skype icon off the taskbar. There are mostly results that instruct changing the shortcut's Compatibility mode to SP2. That sounds clever but Skype itself directly supports this.

- Open Skype...
- Click Tools in the menu bar...
- Click the Options menu item... a new window will open...
- Click the Advanced button on the bottom left of the new window...
- Skype should have a checkbox entry that says "Keep Skype in the taskbar while I'm signed in."
UpdatePanel isn't working, ScriptManager seems to not be rendering?
2011-06-29 12:17 PM
Where to start... I was using RadAjaxPanel with a standard ListBox and AutoPostBack enabled. After clicking the new ListItem, the event would not fire. Turns out that the RadAjaxPanel I was using was out-of-date that I believe was targeting the .NET 2.0 Framwork. This would be a good time to explore using the standard .NET 4.0 UpdatePanel.

I found several demos that worked on their own in a new 4.0 project. However when adding the demo code to our existing project, it didn't work. The project had been updated from 1.1, to 2.0 to now 4.0 and it might have even been upgraded from 1.0 to 1.1 - it's been around a while now.

I noticed that the demo's rendered HTML had a few things different from our implimentation of the demo. Where the ScriptManager was at, the demo had:
<script type="text/javascript">
Sys.WebForms.PageRequestManager._initialize('scriptMgr', 'form1', ['tupdatePnl','updatePnl'], [], [], 90, '');

After a LOT more google searching, led me to checking over the Web.Config for proper entries:

Turns out I was missing this:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

and this had to be removed:
<xhtmlConformance mode="Legacy"/>



View DOM Source
2011-06-28 08:25 AM
Often times the original View Source in a web browser is not sufficient for developers due to AJAX, jQuery, etc.. The developer tools in IE 8 (access by pressing F12) are pretty useful, but today I stumbled on View DOM Source.

Access it by View, Source, DOM (Page) - or press Ctrl+G
VHD Corruption - Not cool, UGH.
2011-05-26 5:35 AM
Quick description of my setup... I do my dev work in VMs, in this particular case I have a Win7 host with my VM file on a Bitlocker partition. I'm using Oracle VirtualBox to access a Win7 guest, that has like ~140GB dynamic drive, ~actual size 40GB.

While restoring a DB in SSMS 2008, the VM drive grows with the restore and fills the host drive. Of course SSMS and the guest Win7 doesn't report being out of space, b/c technically the VM drive isn't out of space. VirtualBox doesn't say it's out of space... why? That's a good question, but if I could have saved a lot of grief if it threw up something like "Hey your VM is trying to write to the drive and it's out of space. Your VM has been paused. Retry? Abort?"

Anyhow, VirtualBox along with everything else on my box is halting "This process is not responding..."

Not cool. UGH. More digging, I kill the VirtualBox task. Restart VirtualBox. Error with drive:
Failed to open the hard disk D:\abcde.vhd.
Could not get teh storage format of the medium 'D:\abcde.vhd' (VERR_NOT_SUPPORTED).
Result Code:


IMedium {1d578f43-5ef1-4415-b556-7592d3ccdc8f}

IVirtualBox {3f36e024-7fed-4f20-a02c-9158a82b44e6}

Immediately copy the broken VHD to an external drive.

Not cool. UGH. More digging, I try mounting the VHD in Win7...Start, Computer Management, Disk Management, Action, Attach VHD, and I get this:

The file or directory is corrupted and unreadable.

Not cool. UGH. More digging, I found a post about using WinImage (http://www.winimage.com/) to read the VHD. So I open it in WinImage and woohoo it opened... except half my data is missing. The C:\Users folder isn't even listed.

Not cool. UGH. More digging, I came across a bunch of other posts and disregarded them, then later wanted to go back to it but couldn't find them. The gist of it was that a person fixed their corrupted header on their dynamic VHD by using a utility to convert it to a fixed size VHD. The result should be that my 120GB dynamic VHD would result in a 40GB fixed size VHD. They had a link to VHDTool (http://archive.msdn.microsoft.com/vhdtool) so I figured I'd give it a whirl. Data should be intact and just have a new header.

Run the utility to convert to fixed size, seems ok, open in WinImage, files still there. Mount in Win7, error. VHD looks like one big blob of unformatted space. Try VirtualBox... the VHD mounts, but it won't boot. Makes sense. It's now a fixed size VHD with 0 free bytes. Mount to a diff VM as a secondary drive. Boot, OS says the secondary drive needs to be formatted.

Not cool. UGH. More digging, but nothing new to try yet. So I figure the VHD has a new header now, and I can see my data in WinImage... So I'll just try converting back to a dynamic drive again and see if I can then boot.

Guess what I learned. WinImage has menus! And under those menus are various little neat tricks... like.... Disk, Convert VHD image...

I convert the new fixed size VHD, to a dynamic VHD, WinImage shows the new data, but still missing C:\Users. I try mounting in Win7, drive mounts! VirtualBox media manager opens the VHD! Boot the Win7 OS..... SUCCESS!!!! :)

Looking back, WinImage was able to see the contents of the original corrupted VHD, so maybe I could have used it to open the corrupt VHD and then immediately re-write it back out, without having to use the Microsoft tool. If the VHD corrupts a 2nd time, then I'll try that ;)

Every blog needs a first post.
2011-05-25 4:53 AM
As a programmer, I *know* I should be contributing back to the community, but it's always been on the back burner. I also *know* that I, like many other programmers, do not enjoy writing documentation. Anyhow, I thought my most recent situation is worth documenting because wow I was in quite a pinch. So... I guess it's time to start a blog!