AjaxControlToolkit - Could not find any resources appropriate for the specified culture or the neutral culture

It was a surprise when I suddenly see a YSOD in a newly added webpage.

Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "AjaxControlToolkit.Properties.Resources.NET4.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Ah! After some careful look at the code, there it is. I forgot to add the ToolkitScriptManager.

Now that was a silly and careless mistake.Crying face

Javascript - plus sign changing to whitespace while opening popup window


Last day, one of my colleague approached me with a strange problem. She had a button whose client-side click opens a popup window. At the time of opening, she’s passing a sequence number as querystring value, which contains a plus(+) sign.

But, upon receiving the querystring value, the plus(+) sign was automatically converted to a white-space.

case1

As a quick fix, she thought about replacing the whitespace with plus(+) sign, while reading the querystring. But, that’s not a solution at all. Because, if the sequence contains both plus sign and whitespace, we cannot distinguish them and the above method fails.

Another option was to encode the complete url before calling window.open and decode it at the server-side. But, that will not solve the problem either.

However, the solution is pretty straight forward and simple. Encode the querystring value using encodeURIComponent() method. Please note, encode querystring value ONLY.

case2

Yup! That’s the solution.

Thanks!

ASP.NET - Launch debugger programmatically using debugger.launch


For last few months, I’s working in a large scale project which runs both Classic ASP and ASP.NET in parallel. While debugging, we used Attach Process of Visual Studio 2010 to attach w3wp.exe. But for some reason, the process was not attaching and I’s unable to debug my application.

After hours of digging, I came across a nice workout. You can programmatically launch the debugger as below:

using System.Diagnostics;
 
// launch the debugger and attach to current process
Debugger.Launch();

As a side-note, for Classic ASP/VBScript use stop keyword and for Javascript use debugger;

Note: What I have mentioned is only for testing/debugging purpose and do remove the above code before moving to production server.

Happy debugging!

Thanks.