A little something about everything

internet marketing and website development made simple..

How to solve the F12 Developer Console Error net::ERR_INCOMPLETE_CHUNKED_ENCODING error.

So you open up F12 and see this obscure error:

What now?

In some cases this is caused by browser updates or perhaps server changes like adding gzip support to IIS.

This error in most cases is to to some code not properly closing before another script is executed thus chunking the response.

You should review the code for the page and look for Response.Close(); method. Something like this:

and replace it with a proper Response.End(); method instead.

Now save and reload your page.

How to show/hide a asp.net sub element with jquery

This method allows you to show/hide a form element without making another request against the server. It also works when the show/hide element is required by the asp.net code behind.

You can use any type of sub element under a dropdown with this script. You will need to use a CDN or download and host your own jquery-1.3.2.min.js file.

SCRIPT

<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(function() { $('#<%= Dropdown1.ClientID %>').change(function() { if (this.value=="My Value") { $('#<%= Element1.ClientID %> ').css({ visibility: 'visible' }); } else { $('#<%= Element1.ClientID %> ').css({ visibility: 'hidden' }); }}); }); </script>

 

HTML

<asp:DropDownList runat="server" ID="Dropdown1" class="required" >
<asp:ListItem Value=""> none</asp:ListItem>
<asp:ListItem Value="My Value">Some Text Here</asp:ListItem>
</asp:DropDownList>

<!-- place any element here with id="Element1" -->

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified

If you are getting this error:

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

First check that you have Microsoft.Web.Extensions.dll and Microsoft.Web.Extensions.Design.dll in your bin folder. Also check that you are using the correct version of .net in IIS.

If non of these solutions work then verify that if application is in a folder other than root you make this folder an application in IIS. Right click folder "convert to application".

 

How to globally redirect all requests from http to https using asp.net

The most effective method will be to use the global.asax file, here is a basic example:

<script language="C#" runat="server">
protected void Application_BeginRequest(Object sender, EventArgs e)	{
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://"))
{
    HttpContext.Current.Response.Status = "301 Moved Permanently"; 
    HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://","https://")); 
}
}
</script>

In some cases you may already have an application using the global.asax file, you can in many cases add the _BeginRequest function or adapt it if it already exists. For example add this after the <script runat="server"> tag but before any other code.

protected void Application_BeginRequest(object sender, EventArgs e)	{
	if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://"))	{
	HttpContext.Current.Response.Status = "301 Moved Permanently"; 
	HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower().Replace("http://","https://")); 
	}

In some cases this will throw and error, before sure to check the rest of the global.asax file for any other begin requests that may be conflicting. In some cases you may need to adapt the code to work in parallel with exiting code.