CameTooFar

A Nerd's False Positive.

HTTP Error 500.21 - Handler "BlockViewHandler" has a bad module "ManagedPipelineHandler"

Huu…!!!

As usual, jumped into another error when I tried to uploaded nopCommerce CMS kit and browsed for first time.

HTTP Error 500.21 - Internal Server Error
Handler "BlockViewHandler" has a bad module "ManagedPipelineHandler" in its module list

error_iis_nopcommerce_browse


I’s thinking, since I downloaded a ready-made kit, chances of errors should be zero!

Got it! As pre-requisites I installed ASP.NET MVC which had changed the ASP.NET version in my machine. As simple as that, you can fix it by running below command (with admin privilege).

%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i

solution_aspnet_regiis

Thanks.

Error creating control - Response is not available in this context


I bet! You might have came across this error, at least once in your development, while playing with master pages.

Error creating control
Response is not available in this context

But still, the page will render during runtime, without any issues.

aspnet_error_creating_control_response_not_available_in_this_context


I came across this error last night. Though, I have been seeing this error for a last few years, I clearly don’t have an idea what’s exactly the reason for this design-break. But, now I know, Why it’s behaving so!

Here goes the reason. All my content pages are inheriting a base class. One of the functionality of base class is to check for authorized users in the OnInit event of the webpage.

reason_aspnet_error_creating_control_response_not_available_in_this_context_reason


Now, what was the reason for the error?

Read the error message carefully – “Response is not available in this context”. Say it again, “Response is ….”. Now, check the above code again.

Inside the if statement, I’ve a Response.Redirect. In designer mode, Response is simply null because I haven’t executed my webpage yet and does not have any value.

Workaround? Yes, simply include a null check!

solution_aspnet_error_creating_control_response_not_available_in_this_context_solution


Now, rebuilt your website and check the design-mode.

Viola! That’s all.

Please note, objects like Session will also cause this problem because their value won’t be available in design-mode (read more).

Hope this helped.
Thanks!

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