Thursday, October 13, 2016

0 and 1 String was not recognized as a valid Boolean - Boolean Parameter in SQLDatasource

String was not recognized as a valid Boolean, System.FormatException: String was not recognized as a valid Boolean,Boolean parameter SQLDataSource,Setting up Boolean Value SQLDataSource InsertParameters

I had a SQLDataSource with insert parameters and one of which data type was set to Boolean. And I was setting the default value for insert parameters in code behind.

aspx code:
<asp:Parameter Name="bIsActive" Type="Boolean" />


I assumed that 1 or 0 would naturally be converted into Boolean when I did this:

SqlDataSource1.InsertParameters["bIsActive"].DefaultValue = c.Checked ? "1" : "0";


But instead I saw this:

String was not recognized as a valid Boolean.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: String was not recognized as a valid Boolean.
Fig 1: String was not recognized as a valid Boolean


ASP.NET can easily convert 1 and 0 (integer types), but struggles with Strings.

Solution:


I used True and False strings instead of 0 and 1.

SqlDataSource1.InsertParameters["bIsActive"].DefaultValue = c.Checked ? "True" : "False";

Thursday, October 6, 2016

This Page Can’t Be Displayed Turn On TLS 1.0, TLS 1.1, And TLS 1.2

This Page Can’t Be Displayed Turn On TLS 1.0, TLS 1.1, And TLS 1.2,This page can't be displayed error,Cannot Access Some HTTPS Sites with Internet Explorer

For Internet Explorer users getting the following error:

This page can’t be displayed - Turn on TLS 1.0, TLS 1.1, and TLS 1.2
in Advanced settings and try connecting to https://websitename
again. If this error persists, contact your site administrator.
Change settings. 
This issue is observed on IE 11 and doesn't appear on Chrome or Firefox Browsers.


Resolution:


 Launch Internet Explorer | Tools (Alt+X on IE 11) | Options | Advanced and make sure the settings match those below: 


Wednesday, October 5, 2016

Access denied error message while saving files on C drive - Windows 7

Access denied,Access denied saving files,Windows 7 Access Denied saving files, Windows 7 Cannot save files to Drive:,open text files as administrator

I have Windows 7 machine and have set myself as the Administrator. However, when trying to modify an XML file in Notepad and save the file, it states 'Access Denied!'. It will not save the file.



Below is the solution worked for me:

Step 1. Open the notepad application in elevated mode. This can be done by right click the Notepad icon from Windows > Click 'Run as administrator'.

Step 2. You can now edit and save that file in the same folder without any issues.



If you want to open the notepad elevated every time, then right click the Notepad shortcut icon > in 'shortcut' tab click on the 'Advanced' button > tick 'run as administrator'.



Win32Exception (0x80004005): The wait operation timed out

Win32Exception (0x80004005),Win32Exception (0x80004005) The wait operation timed out, The wait operation timed out,SQL Timeout expired
I was running an .NET console application that upon initial load pulls a list of items from a SQL server via a stored procedure. Within few seconds of loading the application, received the below error message:

Exception::System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out::Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.::.Net SqlClient Data Provider

Cause:
The problem was that the stored procedure took ~37 seconds to complete, which is slightly greater than the default timeout for a query to execute - 30 seconds. I figured this by executing the stored procedure manually in SQL Server Management Studio.

Resolution:
We need to set the CommandTimeout (in seconds) so that it is long enough for the command to complete its execution.

added the below line before filling the data adapter.
SqlCommand.CommandTimeout = 60; //60 seconds that is long enough for the stored procedure to complete.

Tuesday, October 4, 2016

Unable to connect to remote server while calling a Webservice

Unable to connect to remote server,Unable to connect to remote server WebService, System.Net.WebException Unable to connect to remote server
I received the following error, while calling a Webservice from an ASP.NET application.

System.Net.WebException: {"Unable to connect to the remote server"}.

Cause:

The internet explorer had the settings of a company proxy server and the application's web.config had no defaultProxy element on it. If the defaultProxy element is empty, the proxy settings from Internet Explorer will be used.


Resolution:

Add the defaultProxy element in web.config and set useDefaultCredentials=true.

<system.net>
    <defaultProxy useDefaultCredentials="true" >
    </defaultProxy>
  </system.net>




Monday, October 3, 2016

Error Creating Control - Failed to create designer 'Telerik.Web.UI.

Telerik Error Creating Control,Error Creating Control Failed to create designer, Telerik Design time error,RadControls
You’ll find this error from time to time when switching to Design View in Visual Studio to work with Telerik Radcontrols, especially after Upgrading to a new version of Telerik UI for ASP.NET Ajax.


Causes:

  • There is a GAC-reference for the Telerik.Web.Design assembly in the project and the      GAC has been updated. As a result, the Telerik.Web.Design assembly, referenced by the WebSite, does not exist in the GAC.
  • The reference to the Telerik.Web.UI assembly (either in Register directive or web.config, or Telerik http handlers/modules registrations in web.config) contains hard-coded version number which does not match the version of the Telerik assembly referenced in your project.
  • Open the application in a machine that doesn't have Telerik UI Installed.


Fortunately there are several ways to solve this problem:

  • GAC Deploy the required version of the Telerik.Web.Design.dll.

The Telerik.Web.Design assembly contains the Visual Studio designers of the controls. 
          Telerik.Web.UI.dll requires Telerik.Web.Design.dll of the same version in the GAC.
Use the command gacutil /i [path to Telerik.Web.Design.dll with latest version]

  • Bin-deploy the design-time assembly Telerik.Web.Design.dll

Remove Telerik.Web.Design.dll from the GAC
Copy Telerik.Web.Design.dll to the bin folder
          Restart Visual Studio

  • Bin-deploy the assembly Telerik.Web.UI.Skins.dll
Copy Telerik.Web.Skins.dll to the bin folder
          Restart Visual Studio
  • In web.config file, removing the specific version, Culture, and PublicKeyToken from the Telerik.Web.UI.WebResource.axd entry.

         Correct Syntax:
        <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*"   validate="false"/>

The second solution did the trick for me. Hopefully one of the above solutions will work for you.