How to apply URL shortner in ASP.Net

Last Reply on Aug 23, 2016 02:32 AM By dharmendr

Posted on Aug 22, 2016 04:42 AM

Hi,

Does anyone here has a guide or has a sample project on URL shortner.I am also looking for guidance on URL Rewritting.

 

Thanks in advance

Posted on Aug 22, 2016 04:42 AM

Posted on Aug 22, 2016 04:48 AM
Vikash21 says:

Hi,

Does anyone here has a guide or has a sample project on URL shortner.I am also looking for guidance on URL Rewritting.

 

Thanks in advance

 Hi Vikash21, Add the below code in your web.config inside <system.webServer /> to hide the .aspx extension.

<rewrite>
      <rules>
        <rule name="extensionless" stopProcessing="true">
          <match url="(.*)\.aspx"/>
          <action type="Redirect" url="{R:1}" redirectType="Permanent"/>
        </rule>
        <rule name="removeextension" enabled="true">
          <match url=".*" negate="false"/>
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            <add input="{URL}" pattern="(.*)\.(.*)" negate="true"/>
          </conditions>
          <action type="Rewrite" url="{R:0}.aspx"/>
        </rule>
      </rules>
    </rewrite> 

 


Posted on Aug 22, 2016 11:50 PM

Go through below link

Personalise the Google URL shortening service with your own domain

Try it. Hope it will help you.


Posted on Aug 23, 2016 02:32 AM