Tuesday, April 16, 2019

TLS 1.2 suport in .Net 4.5 or above

Even thought Net 4.5 or above supports TLS 1.2, .Net default protocol is TLS 1.0. It is recommended to set the SecurityProtocol before any WebRequest calls.

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

var url = "https://www.gmail.com";
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";

Setting SecurityProtocol before any WebRequest calls will make sure that response will not get following error when getting the response.

"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."

Saturday, March 30, 2019

Targeting Microsoft Edge with CSS

CSS snippet follows can be used to target Edge browser

@supports (-ms-ime-align: auto) {
  .className {
        border: 1px solid;
  }
}

Please note that Edge is the only browser that supports this property.

Following snippet can be used to target both Edge/IE browsers.

_:-ms-lang(x),
.classNamer
{
  border: 1px solid;
}

Visit this link for more information,

Cheers
Samitha

Wednesday, February 27, 2019

CSS Accessing Elements using data attributes

When selecting elements in CSS, normally we user ID or class to select them. We can use data attribute in an element to select an element as shown below.

HTML

<div data-somename>
  Hi
</div>

CSS
[data-somename] {
color: red;
font-style: underline;

}

Cheers,
Samitha

Friday, February 15, 2019

read only radio input

A radio button can be easily disabled using "return false" on click as shown below.


<input type="radio" id="rbOptions" checked="checked" onclick="return false;"/>

Cheers
Samitha


Thursday, January 24, 2019

get RadioButtonList selected value.

You can use jQuery / JavaScript to get the selected value of a RadioButtonList . jQuery provides much more simpler approach as shown below.

jQuery
var selectedVal = $('#<%= RadioButtonList.ClientID %> input:checked').val();

JavaScript

var radioList= document.getElementById("<%= RadioButtonList.ClientID %>");
 var options= radioList.getElementsByTagName("input");
 var selected;
 for (var i = 0; i < options.length; i++) {
      if (options[i].checked) {
          selected = options[i];
          break;
       }
  }
  if (selected) {
       alert(selected.value);
  }

Regards,
Samitha

Wednesday, January 9, 2019

jQuery find element in a table

jQuery can be used to find an element inside a table easily as shown below.

var td = $("#tbIntervalos").find("#tdId");

cheers
Samitha

Saturday, December 22, 2018

The "SqlBuildTask" task failed unexpectedly

When using Visual Studio database projects, suddenly you will come across The "SqlBuildTask" task failed unexpectedly when building the database project.

The reason behind this error is a recent update to SQL Server Data Tools (SSDT) for Visual Studio. You can find all previous releases for SSDT here.

Cheers,
Samitha