url rewriting with no extension in url

Discussion in 'ASP .Net' started by =?Utf-8?B?cmFwaWRkYXRh?=, Nov 1, 2006.

  1. //reposting because of spelling mistake in "rewritting" in original post

    Is there a way to rewrite urls that have no extensions in the url, i.e. no
    ..aspx or no .html
    like
    http://www.mywebsite.com/username
    to be rewritten as
    http://www.mywebsite.com/pages/username.aspx

    This is currently done in myspace.com where you can type
    http://www.myspace.com/username

    So far I have not found a solution to this problem.

    When I go to IIS Management Console and try to do the
    configuration extension mapping, it does not allow me to enter
    ..* or no extension for the mapping to the asp.net dll

    Any help is greatly appreciated.

    Thanks,
    Leo
    201-923-9595
     
    =?Utf-8?B?cmFwaWRkYXRh?=, Nov 1, 2006
    #1
    1. Advertising

  2. Unless you map the wildcard * to the ASP.NET ISAPI dll, which would make all
    requests - even for images - go through ASP.NET and "hit" your urlrewriting
    code, no.

    You can use rewriting at the ISAPI level instead, if that's your goal. There
    are several products out there, (ISAPI_REWRITE LITE is one that's free).
    However, if you are in a shared hosting environment, it wouldn't help since
    you'd need access to the desktop to install in IIS.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "rapiddata" wrote:

    > //reposting because of spelling mistake in "rewritting" in original post
    >
    > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > .aspx or no .html
    > like
    > http://www.mywebsite.com/username
    > to be rewritten as
    > http://www.mywebsite.com/pages/username.aspx
    >
    > This is currently done in myspace.com where you can type
    > http://www.myspace.com/username
    >
    > So far I have not found a solution to this problem.
    >
    > When I go to IIS Management Console and try to do the
    > configuration extension mapping, it does not allow me to enter
    > .* or no extension for the mapping to the asp.net dll
    >
    > Any help is greatly appreciated.
    >
    > Thanks,
    > Leo
    > 201-923-9595
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Nov 1, 2006
    #2
    1. Advertising

  3. Peter -

    Thanks for you advice.
    I will research ISAPI_REWRITE LITE

    Also there was another suggestion by Gregory but I am in the process of
    registering to Visual Studio Magazine to see the article refered to in the
    link below:

    Thanks for your help. I will give you more feedback soon.
    Also can you please tell me your thoughts on Gregory's suggestion?

    Thanks,
    Leo
    201-923-9595


    By: Cowboy (Gregory A. Beamer) In:
    microsoft.public.dotnet.framework.aspnet


    http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com



    "Peter Bromberg [C# MVP]" wrote:

    > Unless you map the wildcard * to the ASP.NET ISAPI dll, which would make all
    > requests - even for images - go through ASP.NET and "hit" your urlrewriting
    > code, no.
    >
    > You can use rewriting at the ISAPI level instead, if that's your goal. There
    > are several products out there, (ISAPI_REWRITE LITE is one that's free).
    > However, if you are in a shared hosting environment, it wouldn't help since
    > you'd need access to the desktop to install in IIS.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "rapiddata" wrote:
    >
    > > //reposting because of spelling mistake in "rewritting" in original post
    > >
    > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > > .aspx or no .html
    > > like
    > > http://www.mywebsite.com/username
    > > to be rewritten as
    > > http://www.mywebsite.com/pages/username.aspx
    > >
    > > This is currently done in myspace.com where you can type
    > > http://www.myspace.com/username
    > >
    > > So far I have not found a solution to this problem.
    > >
    > > When I go to IIS Management Console and try to do the
    > > configuration extension mapping, it does not allow me to enter
    > > .* or no extension for the mapping to the asp.net dll
    > >
    > > Any help is greatly appreciated.
    > >
    > > Thanks,
    > > Leo
    > > 201-923-9595
    > >
    > >
     
    =?Utf-8?B?cmFwaWRkYXRh?=, Nov 1, 2006
    #3
  4. Could you point us to the post where "Gregory" made his suggestion? I do not
    see anything is this thread.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "rapiddata" wrote:

    > Peter -
    >
    > Thanks for you advice.
    > I will research ISAPI_REWRITE LITE
    >
    > Also there was another suggestion by Gregory but I am in the process of
    > registering to Visual Studio Magazine to see the article refered to in the
    > link below:
    >
    > Thanks for your help. I will give you more feedback soon.
    > Also can you please tell me your thoughts on Gregory's suggestion?
    >
    > Thanks,
    > Leo
    > 201-923-9595
    >
    >
    > By: Cowboy (Gregory A. Beamer) In:
    > microsoft.public.dotnet.framework.aspnet
    >
    >
    > http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > http://gregorybeamer.spaces.live.com
    >
    >
    >
    > "Peter Bromberg [C# MVP]" wrote:
    >
    > > Unless you map the wildcard * to the ASP.NET ISAPI dll, which would make all
    > > requests - even for images - go through ASP.NET and "hit" your urlrewriting
    > > code, no.
    > >
    > > You can use rewriting at the ISAPI level instead, if that's your goal. There
    > > are several products out there, (ISAPI_REWRITE LITE is one that's free).
    > > However, if you are in a shared hosting environment, it wouldn't help since
    > > you'd need access to the desktop to install in IIS.
    > > Peter
    > >
    > > --
    > > Co-founder, Eggheadcafe.com developer portal:
    > > http://www.eggheadcafe.com
    > > UnBlog:
    > > http://petesbloggerama.blogspot.com
    > >
    > >
    > >
    > >
    > > "rapiddata" wrote:
    > >
    > > > //reposting because of spelling mistake in "rewritting" in original post
    > > >
    > > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > > > .aspx or no .html
    > > > like
    > > > http://www.mywebsite.com/username
    > > > to be rewritten as
    > > > http://www.mywebsite.com/pages/username.aspx
    > > >
    > > > This is currently done in myspace.com where you can type
    > > > http://www.myspace.com/username
    > > >
    > > > So far I have not found a solution to this problem.
    > > >
    > > > When I go to IIS Management Console and try to do the
    > > > configuration extension mapping, it does not allow me to enter
    > > > .* or no extension for the mapping to the asp.net dll
    > > >
    > > > Any help is greatly appreciated.
    > > >
    > > > Thanks,
    > > > Leo
    > > > 201-923-9595
    > > >
    > > >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Nov 1, 2006
    #4
  5. From: "Cowboy \(Gregory A. Beamer\)" <>
    References: <>
    Subject: Re: url rewritting with no extension in url
    Date: Tue, 31 Oct 2006 07:40:04 -0600

    He suggested reviewing :

    http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en espaƱol : http://asp.net.do/foros/
    ===================================
    "Peter Bromberg [C# MVP]" <> wrote in message
    news:...
    > Could you point us to the post where "Gregory" made his suggestion? I do not
    > see anything is this thread.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "rapiddata" wrote:
    >
    >> Peter -
    >>
    >> Thanks for you advice.
    >> I will research ISAPI_REWRITE LITE
    >>
    >> Also there was another suggestion by Gregory but I am in the process of
    >> registering to Visual Studio Magazine to see the article refered to in the
    >> link below:
    >>
    >> Thanks for your help. I will give you more feedback soon.
    >> Also can you please tell me your thoughts on Gregory's suggestion?
    >>
    >> Thanks,
    >> Leo
    >> 201-923-9595
    >>
    >>
    >> By: Cowboy (Gregory A. Beamer) In:
    >> microsoft.public.dotnet.framework.aspnet
    >>
    >>
    >> http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/
    >>
    >> --
    >> Gregory A. Beamer
    >> MVP; MCP: +I, SE, SD, DBA
    >> http://gregorybeamer.spaces.live.com
    >>
    >>
    >>
    >> "Peter Bromberg [C# MVP]" wrote:
    >>
    >> > Unless you map the wildcard * to the ASP.NET ISAPI dll, which would make all
    >> > requests - even for images - go through ASP.NET and "hit" your urlrewriting
    >> > code, no.
    >> >
    >> > You can use rewriting at the ISAPI level instead, if that's your goal. There
    >> > are several products out there, (ISAPI_REWRITE LITE is one that's free).
    >> > However, if you are in a shared hosting environment, it wouldn't help since
    >> > you'd need access to the desktop to install in IIS.
    >> > Peter
    >> >
    >> > --
    >> > Co-founder, Eggheadcafe.com developer portal:
    >> > http://www.eggheadcafe.com
    >> > UnBlog:
    >> > http://petesbloggerama.blogspot.com
    >> >
    >> >
    >> >
    >> >
    >> > "rapiddata" wrote:
    >> >
    >> > > //reposting because of spelling mistake in "rewritting" in original post
    >> > >
    >> > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    >> > > .aspx or no .html
    >> > > like
    >> > > http://www.mywebsite.com/username
    >> > > to be rewritten as
    >> > > http://www.mywebsite.com/pages/username.aspx
    >> > >
    >> > > This is currently done in myspace.com where you can type
    >> > > http://www.myspace.com/username
    >> > >
    >> > > So far I have not found a solution to this problem.
    >> > >
    >> > > When I go to IIS Management Console and try to do the
    >> > > configuration extension mapping, it does not allow me to enter
    >> > > .* or no extension for the mapping to the asp.net dll
    >> > >
    >> > > Any help is greatly appreciated.
    >> > >
    >> > > Thanks,
    >> > > Leo
    >> > > 201-923-9595
    >> > >
    >> > >
     
    Juan T. Llibre, Nov 1, 2006
    #5
  6. Peter -

    http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/

    What do you think about this method?

    Thanks,
    Leo

    "Peter Bromberg [C# MVP]" wrote:

    > Could you point us to the post where "Gregory" made his suggestion? I do not
    > see anything is this thread.
    > Peter
    >
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "rapiddata" wrote:
    >
    > > Peter -
    > >
    > > Thanks for you advice.
    > > I will research ISAPI_REWRITE LITE
    > >
    > > Also there was another suggestion by Gregory but I am in the process of
    > > registering to Visual Studio Magazine to see the article refered to in the
    > > link below:
    > >
    > > Thanks for your help. I will give you more feedback soon.
    > > Also can you please tell me your thoughts on Gregory's suggestion?
    > >
    > > Thanks,
    > > Leo
    > > 201-923-9595
    > >
    > >
    > > By: Cowboy (Gregory A. Beamer) In:
    > > microsoft.public.dotnet.framework.aspnet
    > >
    > >
    > > http://www.fawcette.com/vsm/2002_02/magazine/columns/qa/
    > >
    > > --
    > > Gregory A. Beamer
    > > MVP; MCP: +I, SE, SD, DBA
    > > http://gregorybeamer.spaces.live.com
    > >
    > >
    > >
    > > "Peter Bromberg [C# MVP]" wrote:
    > >
    > > > Unless you map the wildcard * to the ASP.NET ISAPI dll, which would make all
    > > > requests - even for images - go through ASP.NET and "hit" your urlrewriting
    > > > code, no.
    > > >
    > > > You can use rewriting at the ISAPI level instead, if that's your goal. There
    > > > are several products out there, (ISAPI_REWRITE LITE is one that's free).
    > > > However, if you are in a shared hosting environment, it wouldn't help since
    > > > you'd need access to the desktop to install in IIS.
    > > > Peter
    > > >
    > > > --
    > > > Co-founder, Eggheadcafe.com developer portal:
    > > > http://www.eggheadcafe.com
    > > > UnBlog:
    > > > http://petesbloggerama.blogspot.com
    > > >
    > > >
    > > >
    > > >
    > > > "rapiddata" wrote:
    > > >
    > > > > //reposting because of spelling mistake in "rewritting" in original post
    > > > >
    > > > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > > > > .aspx or no .html
    > > > > like
    > > > > http://www.mywebsite.com/username
    > > > > to be rewritten as
    > > > > http://www.mywebsite.com/pages/username.aspx
    > > > >
    > > > > This is currently done in myspace.com where you can type
    > > > > http://www.myspace.com/username
    > > > >
    > > > > So far I have not found a solution to this problem.
    > > > >
    > > > > When I go to IIS Management Console and try to do the
    > > > > configuration extension mapping, it does not allow me to enter
    > > > > .* or no extension for the mapping to the asp.net dll
    > > > >
    > > > > Any help is greatly appreciated.
    > > > >
    > > > > Thanks,
    > > > > Leo
    > > > > 201-923-9595
    > > > >
    > > > >
     
    =?Utf-8?B?cmFwaWRkYXRh?=, Nov 1, 2006
    #6
  7. Without messing with ISAPIs you can not do that.

    You can have a workaround by specifying your custom 404 page in IIS settings
    and setting it to be (let say) 404.aspx
    then you can do whatever you want.

    The key is to transfer control to ASP.NET engine. Unfortunately the only way
    to do it is to use aspx extensions in your requests.
    But be ready that some pictures you forgot to upload on a server will be
    triggering the same 404.aspx page.


    George.



    "rapiddata" <> wrote in message
    news:...
    > //reposting because of spelling mistake in "rewritting" in original post
    >
    > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > .aspx or no .html
    > like
    > http://www.mywebsite.com/username
    > to be rewritten as
    > http://www.mywebsite.com/pages/username.aspx
    >
    > This is currently done in myspace.com where you can type
    > http://www.myspace.com/username
    >
    > So far I have not found a solution to this problem.
    >
    > When I go to IIS Management Console and try to do the
    > configuration extension mapping, it does not allow me to enter
    > .* or no extension for the mapping to the asp.net dll
    >
    > Any help is greatly appreciated.
    >
    > Thanks,
    > Leo
    > 201-923-9595
    >
    >
     
    George Ter-Saakov, Nov 1, 2006
    #7
  8. What about this:

    You can also get insanely clever with VirtualPathProvider. I'm
    currently writing a blog engine with this (got to while away the hours
    somehow) and it means I can do highly hackable URLS like:

    /index
    /index/2006
    /index/2006/oct.rss
    /posts/TitleOfPost
    /posts/TitleOfPost.json
    /posts/TitleOfPost/comments.rss(0,92)
    /tag/SomeTag/
    /tag/SomeTag/MicroSummary.atom

    where the files referenced by those URLs don't exist, the
    VirtualPathProvider can parse the URL and return an appropriate
    VirtualFile.

    In your case I think you could create VirtualPathProvider to do the
    following:

    is the URL in the pages directory?
    no -> Pass it back to the default handler
    yes ->
    does the URL contain .aspx?
    yes -> pass it back to the default handler
    no -> pass url+".aspx" back to the default handler


    There's a fairly relevant link here
    [http://blogs.msdn.com/davidebb/arch...ne-behavior-using-a-virtualpathprovider.aspx]


    "George Ter-Saakov" wrote:

    > Without messing with ISAPIs you can not do that.
    >
    > You can have a workaround by specifying your custom 404 page in IIS settings
    > and setting it to be (let say) 404.aspx
    > then you can do whatever you want.
    >
    > The key is to transfer control to ASP.NET engine. Unfortunately the only way
    > to do it is to use aspx extensions in your requests.
    > But be ready that some pictures you forgot to upload on a server will be
    > triggering the same 404.aspx page.
    >
    >
    > George.
    >
    >
    >
    > "rapiddata" <> wrote in message
    > news:...
    > > //reposting because of spelling mistake in "rewritting" in original post
    > >
    > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > > .aspx or no .html
    > > like
    > > http://www.mywebsite.com/username
    > > to be rewritten as
    > > http://www.mywebsite.com/pages/username.aspx
    > >
    > > This is currently done in myspace.com where you can type
    > > http://www.myspace.com/username
    > >
    > > So far I have not found a solution to this problem.
    > >
    > > When I go to IIS Management Console and try to do the
    > > configuration extension mapping, it does not allow me to enter
    > > .* or no extension for the mapping to the asp.net dll
    > >
    > > Any help is greatly appreciated.
    > >
    > > Thanks,
    > > Leo
    > > 201-923-9595
    > >
    > >

    >
    >
    >
     
    =?Utf-8?B?cmFwaWRkYXRh?=, Nov 2, 2006
    #8
  9. You probably *could* use a VPP, but I think it's overkill. It has its
    own set of drawbacks (no precompilation for one). I'm mostly using it
    because - damn it - it's hella cool, and I want to use it as a test-bed
    for creating RESTful json web services at some point in the future.

    -- flink

    rapiddata wrote:

    > What about this:
    >
    > You can also get insanely clever with VirtualPathProvider. I'm
    > currently writing a blog engine with this (got to while away the hours
    > somehow) and it means I can do highly hackable URLS like:
    >
    > /index
    > /index/2006
    > /index/2006/oct.rss
    > /posts/TitleOfPost
    > /posts/TitleOfPost.json
    > /posts/TitleOfPost/comments.rss(0,92)
    > /tag/SomeTag/
    > /tag/SomeTag/MicroSummary.atom
    >
    > where the files referenced by those URLs don't exist, the
    > VirtualPathProvider can parse the URL and return an appropriate
    > VirtualFile.
    >
    > In your case I think you could create VirtualPathProvider to do the
    > following:
    >
    > is the URL in the pages directory?
    > no -> Pass it back to the default handler
    > yes ->
    > does the URL contain .aspx?
    > yes -> pass it back to the default handler
    > no -> pass url+".aspx" back to the default handler
    >
    >
    > There's a fairly relevant link here
    > [http://blogs.msdn.com/davidebb/arch...ne-behavior-using-a-virtualpathprovider.aspx]
    >
    >
    > "George Ter-Saakov" wrote:
    >
    > > Without messing with ISAPIs you can not do that.
    > >
    > > You can have a workaround by specifying your custom 404 page in IIS settings
    > > and setting it to be (let say) 404.aspx
    > > then you can do whatever you want.
    > >
    > > The key is to transfer control to ASP.NET engine. Unfortunately the only way
    > > to do it is to use aspx extensions in your requests.
    > > But be ready that some pictures you forgot to upload on a server will be
    > > triggering the same 404.aspx page.
    > >
    > >
    > > George.
    > >
    > >
    > >
    > > "rapiddata" <> wrote in message
    > > news:...
    > > > //reposting because of spelling mistake in "rewritting" in original post
    > > >
    > > > Is there a way to rewrite urls that have no extensions in the url, i.e. no
    > > > .aspx or no .html
    > > > like
    > > > http://www.mywebsite.com/username
    > > > to be rewritten as
    > > > http://www.mywebsite.com/pages/username.aspx
    > > >
    > > > This is currently done in myspace.com where you can type
    > > > http://www.myspace.com/username
    > > >
    > > > So far I have not found a solution to this problem.
    > > >
    > > > When I go to IIS Management Console and try to do the
    > > > configuration extension mapping, it does not allow me to enter
    > > > .* or no extension for the mapping to the asp.net dll
    > > >
    > > > Any help is greatly appreciated.
    > > >
    > > > Thanks,
    > > > Leo
    > > > 201-923-9595
    > > >
    > > >

    > >
    > >
    > >
     
    Flinky Wisty Pomm, Nov 2, 2006
    #9
    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:
    475
    Colin Young
    Aug 15, 2003
  2. Thedotnetteer
    Replies:
    2
    Views:
    809
    Thedotnetteer
    Nov 27, 2003
  3. sandeep pandit via .NET 247
    Replies:
    0
    Views:
    913
    sandeep pandit via .NET 247
    Apr 28, 2004
  4. Brian
    Replies:
    0
    Views:
    1,816
    Brian
    Jun 19, 2004
  5. Gaurav  Agarwal
    Replies:
    2
    Views:
    747
    Gaurav Agarwal
    Jan 31, 2005
Loading...

Share This Page