URL rewriting

Discussion in 'ASP .Net' started by Hemant, Sep 11, 2009.

  1. Hemant

    Hemant Guest

    Hi All,

    I am using global.asax for rewriting the url.
    In Application_BeginRequest I do the following.
    Dim fullOrigionalpath As String =
    Request.AppRelativeCurrentExecutionFilePath.ToUpper().Replace("~/",
    "").ToLower()

    if (fullOrigionalpath.Contains("fruit.html")) Then

    Context.RewritePath("Product.aspx?RootCategoryID=1004", False)

    end if

    It is working fine if I run the code without the IIS .

    for example: http://localhost:3905/abc.com/fruit.html

    but if I run this from IIS I got error .

    for example : http://localhost/abc.com/fruit.html

    in this i Got 404 error .

    What is the reason

    What am I missing ?

    Please help me.

    Thanks,

    Hemant
     
    Hemant, Sep 11, 2009
    #1
    1. Advertising

  2. Hemant

    Patrice Guest

    With IIS6, by default HTML pages are not processed by ASP.NET.

    See http://msdn.microsoft.com/en-us/library/ms972974.aspx and in particular
    "What Happens When a Request Reaches IIS". You'll have to map the .html
    extension to the aspnet_isapi.dll...

    You could perhaps see if you could avoit any extension especially if you
    feel that fruit/orange or fruit/apple could be used one day...

    --
    Patrice
     
    Patrice, Sep 11, 2009
    #2
    1. Advertising

  3. Hemant

    Hemant Guest

    Hi,
    Thanks for your reply.
    ..* extension is work in IIS 6 but not IIS 5
    so how to handle with this?
    thanks
    Hemant.
    "Patrice" <http://scribe-en.blogspot.com/> wrote in message
    news:%23hl$...
    > With IIS6, by default HTML pages are not processed by ASP.NET.
    >
    > See http://msdn.microsoft.com/en-us/library/ms972974.aspx and in
    > particular "What Happens When a Request Reaches IIS". You'll have to map
    > the .html extension to the aspnet_isapi.dll...
    >
    > You could perhaps see if you could avoit any extension especially if you
    > feel that fruit/orange or fruit/apple could be used one day...
    >
    > --
    > Patrice
    >
    >
    >
     
    Hemant, Sep 11, 2009
    #3
  4. Hemant

    Patrice Guest

    And just .html doesn't work ? Unfortunately it's quite a long time I'm awa
    from IIS 5 boxes ;-)

    --
    Patrice
     
    Patrice, Sep 11, 2009
    #4
  5. Hemant wrote:
    > It is working fine if I run the code without the IIS .
    >
    > for example: http://localhost:3905/abc.com/fruit.html
    >
    > but if I run this from IIS I got error .
    >
    > for example : http://localhost/abc.com/fruit.html
    >
    > in this i Got 404 error .
    >
    > What is the reason


    By default, dots are not allowed in paths in IIS6 (and later versions, I
    expect) as in "abc.com".

    You may find the error listed in a log file in IIS's HTTPERR directory.

    Andrew
     
    Andrew Morton, Sep 14, 2009
    #5
  6. Hemant

    Hemant Guest

    Hi,
    Thanks for your reply.
    I am using IIS 5.1 at my machine but at the production this is IIS 6.0.
    I have done url mapping on my machine and it working fine but as i deployed
    it on production I got error.
    error 1: Once i click on https: page than https : remain for all the pages
    error 2: Image's path are wrong.
    error 3: it is adding extra path to url
    as http://abc.com/Test/apples.html it this link you can see Test is added
    extra but at my local machine it is like
    http://abc.com/apples.html
    so please help me.
    thanks,
    hemant

    "Andrew Morton" <> wrote in message
    news:...
    > Hemant wrote:
    >> It is working fine if I run the code without the IIS .
    >>
    >> for example: http://localhost:3905/abc.com/fruit.html
    >>
    >> but if I run this from IIS I got error .
    >>
    >> for example : http://localhost/abc.com/fruit.html
    >>
    >> in this i Got 404 error .
    >>
    >> What is the reason

    >
    > By default, dots are not allowed in paths in IIS6 (and later versions, I
    > expect) as in "abc.com".
    >
    > You may find the error listed in a log file in IIS's HTTPERR directory.
    >
    > Andrew
    >
     
    Hemant, Sep 15, 2009
    #6
  7. > I am using IIS 5.1 at my machine but at the production this is IIS 6.0.
    > I have done url mapping on my machine and it working fine but as i
    > deployed it on production I got error.
    > error 1: Once i click on https: page than https : remain for all the pages


    There is something at
    http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx

    which might be relevant to your changing between https and http.

    There's info at
    http://msdn.microsoft.com/en-us/library/ms972974.aspx

    which might help you. I've used ISAPI Rewrite in the past. The cost of it
    might be less than you trying to implement that functionality. (Disclaimer:
    I have no connection with that product other than as a user.)

    HTH,

    Andrew
     
    Andrew Morton, Sep 22, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Juha Borenius

    URL rewriting

    Juha Borenius, Aug 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    480
    Colin Young
    Aug 15, 2003
  2. Thedotnetteer
    Replies:
    2
    Views:
    822
    Thedotnetteer
    Nov 27, 2003
  3. sandeep pandit via .NET 247
    Replies:
    0
    Views:
    923
    sandeep pandit via .NET 247
    Apr 28, 2004
  4. Gaurav  Agarwal
    Replies:
    2
    Views:
    762
    Gaurav Agarwal
    Jan 31, 2005
  5. =?Utf-8?B?cmFwaWRkYXRh?=

    url rewriting with no extension in url

    =?Utf-8?B?cmFwaWRkYXRh?=, Nov 1, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    424
    Flinky Wisty Pomm
    Nov 2, 2006
Loading...

Share This Page