Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am implementing URL rewriting in my project werein i want my URL:
http://localhost:54611/WebSite6/Customer.aspx[^]

to look like:
http://localhost:54611/WebSite6/Customer[^]

I added Intelligencia.UrlRewriter.dll to my bin folder.

And i added the below written code in my web.config file.

XML
<configuration>
  <configSections>
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
  </configSections>
    <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
    <httpModules>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>

    </httpModules>
    <compilation debug="true" targetFramework="4.0"/>
        <authentication mode="Forms">
            <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
        </authentication>
        <membership>
            <providers>
                <clear/>
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
            </providers>
        </membership>
        <profile>
            <providers>
                <clear/>
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
            </providers>
        </profile>
        <roleManager enabled="false">
            <providers>
                <clear/>
                <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
                <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
            </providers>
        </roleManager>
    </system.web>
    <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrl-Integrated-4.0"/>
    </handlers>
    <modules runAllManagedModulesForAllRequests="true">

      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule"/>
    </modules>
    <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>

  <rewriter>
    <rewrite url="~/Customer$" to="~/Customer.aspx" ignoreCase="true" />
  </rewriter>


</configuration>


I am not getting any errors.But i am not able to remove the .aspx extension from my page.
Posted

1 solution

XML
<rewriter>
   <rewrite url="~/Customer$" to="~/Customer.aspx" ignoreCase="true" />
 </rewriter>



change to
XML
<rewriter>
   <rewrite to="~/Customer$" url="~/Customer.aspx" ignoreCase="true" />
 </rewriter>



hope this one helps you :)
 
Share this answer
 
Comments
Priyanka7777 11-Sep-13 3:34am    
This gives me an error that the "Resource cannot be found".
Dholakiya Ankit 11-Sep-13 4:19am    
yes now u get real url change url path to url="customer.aspx" add path where this page is located

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900