Total Pageviews

Wednesday, November 26, 2014

Adding custom extension (.SEO) to the URL

Add the handler mapping to IIS

 <handlers>
            <add name="*.seo-4.0_32Bit" path="*.seo" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
 </handlers>

If extension not worked, add following between <system.webServer>

<modules runAllManagedModulesForAllRequests="true" >
<remove name="UrlRoutingModule"/>
</modules>

Wednesday, November 19, 2014

Redirections using Web.config

Page redirections for different domain

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   
<location path="hydro-burn">
      <system.webServer>
        <httpRedirect enabled="true" destination="http://www.example.com.au/hydro-burn" httpResponseStatus="Permanent" />
      </system.webServer>
    </location>

<location path="hydro-whey">
      <system.webServer>
        <httpRedirect enabled="true" destination="http://www.example.com.au/hydro-whey" httpResponseStatus="Permanent" />
      </system.webServer>
    </location>

<location path="amino-fuel">
      <system.webServer>
        <httpRedirect enabled="true" destination="http://www.example.com.au/amino-fuel" httpResponseStatus="Permanent" />
      </system.webServer>
    </location>

</configuration>

Domain redirections

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpRedirect enabled="true" destination="http://www.example.com.au" exactDestination="true" httpResponseStatus="Permanent" />
    </system.webServer>
</configuration>

Tuesday, November 4, 2014

Adding mask using Jquery

<script language="javascript" src="../../js/jquery.maskedinput.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {

      //Input mask for ABN
        $('#txtABNstep1').mask('?ABN 99 999 999 999');

        //Input mask for Contact number      
        $('#txtContactNumberStep1').mask('(99) 9999-9999');

        //Input mask for Contact mobile phone
        $('#txtMobileNumberStep1').mask('9999999999');


});

Monday, November 3, 2014

Regex for http, https or www

(http(s)?://)?([\w-]+\.)+[\w-]+[.com]+(/[/?%&=]*)?

Monday, July 28, 2014

Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option

Run below inside the database

sp_configure 'clr enabled',1
GO
RECONFIGURE
GO
sp_configure 'clr enabled'  -- make sure it took
GO

Sunday, July 13, 2014

Accessing parent frames using JQuery

   $(function () {
            $(window).load(function () {
                var frame = window.parent.$('frame[name="frmFrame"]')[0].contentDocument;
                if ($(frame).find('.classname').is(':visible')) {
                        //Do something
                }
                else {
                     //Do something
                }

            })
        })

HTTP to HTTPS Redirect using Rewrite module

Rule to redirect to HTPS, Illustrated domain is treated as www.yourdomain.com.au, if is www.yourdomain.com the pattern will be pattern="^www\.yourdomain\.com$"

     <rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                        <add input="{HTTP_HOST}" pattern="^www\.yourdomain.com\.au$" />
                        <add input="{HttpsRedirects:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{C:1}" appendQueryString="false" redirectType="SeeOther" />
                </rule>

Pages which are to be redirect, Page ending .aspx and extention less are considered.

  <rewriteMaps>
                <rewriteMap name="HttpsRedirects">
                    <add key="/content_common/application.aspx" value="/content_common/application.aspx" />
                    <add key="/content_common/application" value="/content_common/application" />
</rewriteMap>
</rewriteMaps>

Thursday, July 10, 2014

Redirect Non WWW to WWW using Rewrite module

Using Regex

<rewrite>
    <rules>
        <rule name="Redirect domain.com to www" patternSyntax="ECMAScript" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^yourdomain.com$" />
            </conditions>
            <action type="Redirect" url="http://www.yourdomain.com/{R:0}" />
        </rule>
    </rules>
</rewrite>

Using Wildcards

<rewrite>
    <rules>
        <rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="domain.com" />
            </conditions>
            <action type="Redirect" url="http://www.domain.com/{R:0}" />
        </rule>
    </rules>
</rewrite>

Thursday, July 3, 2014

Redirecting HTTP page to HTTPS using Rewrite module


<rewrite>
            <rules>
                <rule name="Redirect to HTTPS" stopprocessing="true">
                    <match url=".*">
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$">
                        <add input="{HTTP_HOST}" pattern="^www\.yourdomain\.com$">
                        <add input="{HttpsRedirects:{REQUEST_URI}}" pattern="(.+)">
                    </add></add></add></conditions>
                    <action appendquerystring="false" redirecttype="SeeOther" type="Redirect" url="https://{HTTP_HOST}/{C:1}">
                </action></match></rule>
            </rules>
            <rewritemaps>
                <rewritemap name="HttpsRedirects">
                    <add key="/content_common/test.aspx?id=b1909882-22c1-4176-8012-9417c50b0276" value="/content_common/test.aspx?id=b1909882-22c1-4176-8012-9417c50b0276">
                 
                </add></rewritemap>
            </rewritemaps>
        </rewrite>