DotNet Postbacks Not Working in IE11

Many people are posting the woes of DotNet Postbacks not working in IE11.  I too experienced this and remembered that there were app_browser files that could be modified to give the browser further instructions.  With a quick google search I was able to find the exact solution that I was looking for.  I cannot take credit for it so I will share the original URL from which I got my answer. [ Answer ]

However Here is the code so you do not have to click on the link above:

 <browsers>  
   <browser id="IE11" parentID="Mozilla">  
     <identification>  
       <userAgent match="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)" />  
       <userAgent nonMatch="IEMobile" />  
     </identification>  
     <capture>  
       <userAgent match="Trident/(?'layoutVersion'\d+)" />  
     </capture>  
     <capabilities>  
       <capability name="browser" value="IE" />  
       <capability name="layoutEngine" value="Trident" />  
       <capability name="layoutEngineVersion" value="${layoutVersion}" />  
       <capability name="extra" value="${extra}" />  
       <capability name="isColor" value="true" />  
       <capability name="letters" value="${letters}" />  
       <capability name="majorversion" value="${major}" />  
       <capability name="minorversion" value="${minor}" />  
       <capability name="screenBitDepth" value="8" />  
       <capability name="type" value="IE${major}" />  
       <capability name="version" value="${version}" />  
     </capabilities>  
   </browser>  
   <!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->  
   <browser id="IE110" parentID="IE11">  
     <identification>  
       <capability name="majorversion" match="11" />  
     </identification>  
     <capabilities>  
       <capability name="ecmascriptversion" value="3.0" />  
       <capability name="jscriptversion" value="5.6" />  
       <capability name="javascript" value="true" />  
       <capability name="javascriptversion" value="1.5" />  
       <capability name="msdomversion" value="${majorversion}.${minorversion}" />  
       <capability name="w3cdomversion" value="1.0" />  
       <capability name="ExchangeOmaSupported" value="true" />  
       <capability name="activexcontrols" value="true" />  
       <capability name="backgroundsounds" value="true" />  
       <capability name="cookies" value="true" />  
       <capability name="frames" value="true" />  
       <capability name="javaapplets" value="true" />  
       <capability name="supportsCallback" value="true" />  
       <capability name="supportsFileUpload" value="true" />  
       <capability name="supportsMultilineTextBoxDisplay" value="true" />  
       <capability name="supportsMaintainScrollPositionOnPostback" value="true" />  
       <capability name="supportsVCard" value="true" />  
       <capability name="supportsXmlHttp" value="true" />  
       <capability name="tables" value="true" />  
       <capability name="supportsAccessKeyAttribute" value="true" />  
       <capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />  
       <capability name="vbscript" value="true" />  
     </capabilities>  
   </browser>  
 </browsers>  

How to change IE11 Useragent

I recently tripped on a need to change the Useragent string for IE11 because of an older DotNet control that I was using and was no longer in development. Again this is not my solution, but it worked for me and I thought I would share it with the world. Since it is not my solution, here is the original link [ Answer ]

 <rewrite>  
 <rules>  
 <rule name="Change IE 11 User Agent to IE 10" enabled="true">  
  <match url="(.*)" />  
  <action type="None" />  
  <conditions>  
   <add input="{HTTP_USER_AGENT}" pattern=".trident\/[789]" />  
  </conditions>  
  <serverVariables>  
   <set name="HTTP_USER_AGENT" value="Mozilla/5.0 (compatible; MSIE 11.0; Windows NT 6.2; Trident/7.0)" />  
  </serverVariables>  
  </rule>  
  </rules>  
 </rewrite>  

To make this work, you need to add the variable “HTTP_USER_AGENT” to the rewrite module in IIS.  If you do not, you will be told to by the error returned in IIS.  For instructions for adding the variable click the following:  [ link ]

IE11 Thinking it is a Cookieless Browser

Recently I had an issue where IE11 did not want to track cookies turning IE11 into a Cookieless Browser.  I learned quickly this is the default behaviour of the browser unless you uncheck a no-tracking option during its setup.  You know that you have an issue when you have a url that has hash like injection in it after a user signs in.  Since you cannot force your users to turn off the no-tracking option, here is a way I got around it for sites with logins.

In the code below, the key is cookieless=”UseCookies”

 <authentication mode="Forms">  
  <forms name=".AUTH" cookieless="UseCookies" loginUrl="/" timeout="10000" path="/" />  
 </authentication>  

How to use SQL to Extract a Number from a String

Recently I had a need to extract the number from a string in the database.  The string would be something like ‘Monitor 16″‘ or “16 inch Monitor”.   I would need to get the size for various reasons including fees and reports, but no real good way of doing it.  I have come up with the following Scalar SQL Function to do this very job.

Continue reading How to use SQL to Extract a Number from a String

MaxMind GEOIP Look-up for Microsoft SQL

Recently I implemented a GEOIP solution on a client site; however, the site was built on a Microsoft SQL database engine and I could not find a solution for looking up the country name easily.  Through some quick Google searches I had tripped on the site for which I started at ( http://dev.maxmind.com/geoip/csv ).  The site maxmind.com gave me the MySQL solution and the mathematical solution for creating the integer.  Based on this information, I created my own function in MS SQL to retrieve me the calculated IP integer for easier use.

Continue reading MaxMind GEOIP Look-up for Microsoft SQL

Posting Data From HTML to ASPX

Recently I had a need to have a web site post credentials to another web site.   The first site was standard HTML and the second site was DotNet (ASP.NET).

In this example, we will be passing a user name and password to another site.

Sending Web Site
In your sending website, you will need a log in  panel similar to the one below.

    






Receiving Web Site
In the form load of your DotNet (ASP.NET) site, you will need the following code to get the values from the request object and then pass to your log in routine.

                NameValueCollection nvc = Request.Form;
string userName = "";
string password = "";
if (!string.IsNullOrEmpty(nvc["txtUserName"]))
{
userName = nvc["txtUserName"];
}

if (!string.IsNullOrEmpty(nvc["txtPassword"]))
{
password = nvc["txtPassword"];
}

ExecuteLogin(userName, password);

HTML Centering DIV Tag ( DIV Element )

The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following.

style=’padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;’

Sample Image

Making Your Web Page Accessible

It seems like a lot of work to make your web page accessible for people with sight impairment, and the audience seems small, but it is worth it. There are a couple of things that web developers often miss when they are evaluating such a task. If people cannot read the website, it is a good possibility that search bots and spiders from sites like Google and Yahoo will have difficulties too (although they have gotten better). By taking the time to properly plan out your site and take the time to follow the W3C standards, you should accomplish 90% or better of the goal to make your site accessible. Making your site accessible is easy and W3C publishes the guidelines.

Here are a couple of quick steps

  1. Use “alt” tags on any content that is not text ( images or graphics
  2. Use the title tags on your hyper links (a) type tags
  3. Create a consistent page layout including heading, menus and content area
  4. Where you use flash, or other plug-in framework, provide a text alternative with an easy and obvious link to it.
  5. Tables should be laid out using the following
 <table>
   <caption>this is a table caption</caption>
   <tr>
       <th>column heading 1</th>
       <th>column heading 2</th>
   </tr>
   <tr>
       <td>column 1</td>
       <td>column 1</td>
   </tr>
</table>