Click here to Skip to main content
15,036,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hello,

I have done some code for url rewriting but issue is its working fine with localhost. But it shows an error (404) online. Tell me what changes need to make in web.config file?

Addition from duplicate question:

please see this url
http://lovejaygore.com/g-info-tech-7

Please suggest me required changes in web.config file.

Web.config File
XML
<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
  <configSections>
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
  </configSections>
  <appSettings/>
  <connectionStrings>
    <add name="sqlcn" connectionString="Data Source=***;database=lovejayg_DBannualReport;uid=***;Pwd=***"/>
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" redirectMode="ResponseRewrite"/>
    <httpModules>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
    </httpModules>
    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
    
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Windows"/>
    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    
  </system.web>
  <rewriter>
    <rewrite url="~/Article/(.+)-(.+).aspx" to="~/DynamicPage.aspx?MyTitleId=$2"/>
  </rewriter>
</configuration>
Posted
Updated 27-May-12 4:15am
v3

1 solution

Check application pool identity settings and make sure that your web application's appPool Identity is set ApplicationPoolIdentity and Managed Pipeline Mode as Integrated.

Then check your web config system.webserver modules and enable this configuration on your application web config.
C#
<system.webserver><modules runallmanagedmodulesforallrequests="true"> </modules></system.webserver>


Fixing 404 errors on invalid URL’s with ASP.NET’s URL Rewrite

UPDATED
================================
Configuration
How to do a rewrite rule in web.config
URL Rewriting in ASP.NET
   
v2

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