Url Rewritin 404 problem

Last post 07-10-2009 5:21 AM by IvanKononenko. 3 replies.

Sort Posts:

  • Url Rewritin 404 problem

    07-08-2009, 6:51 AM
    • Member
      1 point Member
    • IvanKononenko
    • Member since 10-10-2008, 11:39 AM
    • Ukraine
    • Posts 25

    Hi guys, I have following problem.

    Our site makin url rewriting from www.mysite.com/cat=ivan_catid=iii.html to www.mysite.com/ivan_catid.html

    I create new class which inherit IHttpModule and register it in web.config.

    But iss7 told me that page not found with error 404 before I can run Begin_Request method for fix this link.

    Can fix it somehow in iis or in web.config?

    public class UrlInspector : IHttpModule
    {
        public UrlInspector()
        {
            //
            // TODO: Add constructor logic here
            //
        }
    
        public void Init(HttpApplication application)
        {
            application.BeginRequest += (new EventHandler(this.Application_BeginRequest));
        }
    
        private void Application_BeginRequest(Object source, EventArgs e)
        {
    
                string fixedLink = "";
    
                if (!string.IsNullOrEmpty(fixedLink))
                {
                    response.Clear();
                    response.Status = "301 Moved Permanently";
                    response.AddHeader("Location", fixedLink);
                    response.End();
                }
            }
        }
    
        public void Dispose() { }






  • Re: Url Rewritin 404 problem

    07-08-2009, 10:17 AM
    • Member
      588 point Member
    • s.sriram
    • Member since 02-27-2007, 8:38 AM
    • India
    • Posts 91

    Hello,

    Check the below link which show 4 diferent approaches on url re-writing, with examples.


    http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx


    Hope it will help to solve yur problem.




    S.SRIRAM
  • Re: Url Rewritin 404 problem

    07-08-2009, 11:48 AM
    • Member
      1 point Member
    • IvanKononenko
    • Member since 10-10-2008, 11:39 AM
    • Ukraine
    • Posts 25

    Nope I have another problem.

    I can't aceess to Application_BeginRequest method (where redirect to right link making) because iis7 showing 404 error code before.


  • Re: Url Rewritin 404 problem

    07-10-2009, 5:21 AM
    Answer
    • Member
      1 point Member
    • IvanKononenko
    • Member since 10-10-2008, 11:39 AM
    • Ukraine
    • Posts 25

    http://www.improve.dk/blog/2006/12/11/making-url-rewriting-on-iis7-work-like-iis6


    This article resolve my problem.

    Maybe it will help you too.

Page 1 of 1 (4 items)
Microsoft Communities