Url rewriting error 'HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.' in ASP.Net

Last Reply on Jul 04, 2016 02:23 AM By dharmendr

Posted on Jul 04, 2016 02:22 AM

hello sir

my class file code is


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for URLRewriter
/// </summary>
public class URLRewriter : IHttpModule
    //public URLRewriter()
    //    //
    //    // TODO: Add constructor logic here
    //    //
    #region IHttpModule Members

    /// <summary>
    /// Dispose method for the class
    /// If you have any unmanaged resources to be disposed
    /// free them or release them in this method
    /// </summary>
    public void Dispose()
        //not implementing this method
        //for this example

    /// <summary>
    /// Initialization of the http application instance
    /// </summary>
    /// <param name="context"></param>
    public void Init(HttpApplication context)
        context.BeginRequest += new EventHandler(context_BeginRequest);
    /// <summary>
    /// Event handler of instance begin request
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    void context_BeginRequest(object sender, EventArgs e)
        //Create an instance of the application that has raised the event
        HttpApplication httpApplication = sender as HttpApplication;

        //Safety check for the variable httpApplication if it is not null
        if (httpApplication != null)
            //get the request path - request path is    something you get in
            //the url
            string requestPath = httpApplication.Context.Request.Path;

            //variable for translation path
            string translationPath = "";

            //if the request path is /urlrewritetestingapp/laptops/dell/
            //it means the site is for DLL
            //else if "/urlrewritetestingapp/laptops/hp/"
            //it means the site is for HP
            //else it is the default path
            switch (requestPath.ToLower())
                case "/government-exams/Bank%20Jobs/":
                    translationPath = "/Default.aspx?JobHeaderMenuName=Bank%20Jobs";
                case "/government-exams/SSC/":
                    translationPath = "/Default.aspx?JobHeaderMenuName=SSC";
                case "/government-exams/Railways/":
                    translationPath = "/Default.aspx?JobHeaderMenuName=Railways";
                    translationPath = "/government-exams/default.aspx";

            //use server transfer to transfer the request to the actual translated path


my aspx page is

<ul class="nav navbar-nav custom_nav">
                                <li class="active"><a href="http://latestsarkarijob.com">Home</a></li>
                                <li><a href="http://latestsarkarijob.com/government-exams/Bank%20Jobs/">Bank Jobs</a></li>
                                <li><a href="http://localhost:1090/government-exams/SSC/">SSC</a></li>
                                <li><a href="http://localhost:1090/government-exams/Railways/">Railways</a></li>
                                <li><a href="Default.aspx?JobHeaderMenuName=Freshers%20Jobs">UPSC</a></li>
                                <li><a href="Default.aspx?JobHeaderMenuName=Teaching Jobs">Teaching Jobs</a></li>
                                <li><a href="Default.aspx?JobHeaderMenuName=State PCS">State PCS</a></li>
                                <li><a href="Default.aspx?JobHeaderMenuName=Police">Police</a></li>

but it is not work properly

this error is shown on web page

Error Summary

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://latestsarkarijob.com:80/government-exams/Bank Jobs/
Physical Path D:\INETPUB\VHOSTS\latestsarkarijob.com\httpdocs\government-exams\Bank Jobs\
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
  • The directory or file specified does not exist on the Web server.
  • The URL contains a typographical error.
  • A custom filter or module, such as URLScan, restricts access to the file.
This question does not have replies that have been liked.