How to tell if a URL contains a file name?

Discussion in 'ASP .Net' started by Amil, Nov 7, 2007.

  1. Amil

    Amil Guest

    I am using httpwebrequest and httpwebresponse. URLs may or may not contain
    a file name:

    http://www.domain.com/default.aspx
    http://www.domain.com

    The second URL may return the content for default.aspx. Is there any method
    to figure out the file name returns when the second URL format is used?

    I've looked through both the resquest and response objects after the
    content, but don't see anything.

    Amil
    Amil, Nov 7, 2007
    #1
    1. Advertising

  2. Amil wrote:
    > I am using httpwebrequest and httpwebresponse. URLs may or may not contain
    > a file name:
    >
    > http://www.domain.com/default.aspx
    > http://www.domain.com
    >
    > The second URL may return the content for default.aspx. Is there any method
    > to figure out the file name returns when the second URL format is used?
    >
    > I've looked through both the resquest and response objects after the
    > content, but don't see anything.
    >
    > Amil
    >


    HttpWebResponse.ResponseUri

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Nov 7, 2007
    #2
    1. Advertising

  3. Amil

    Amil Guest

    Already looked there...it doesn't resolve if the URL did not contain a file
    name. I think I can know "IF" a file name was not on the URL. After the
    request, is done, if the request URL has an ending slash, it the original
    didn't have a file name.

    Amil

    "Göran Andersson" <> wrote in message
    news:...
    > Amil wrote:
    >> I am using httpwebrequest and httpwebresponse. URLs may or may not
    >> contain a file name:
    >>
    >> http://www.domain.com/default.aspx
    >> http://www.domain.com
    >>
    >> The second URL may return the content for default.aspx. Is there any
    >> method to figure out the file name returns when the second URL format is
    >> used?
    >>
    >> I've looked through both the resquest and response objects after the
    >> content, but don't see anything.
    >>
    >> Amil

    >
    > HttpWebResponse.ResponseUri
    >
    > --
    > Göran Andersson
    > _____
    > http://www.guffa.com
    Amil, Nov 7, 2007
    #3
  4. Amil wrote:
    > Already looked there...it doesn't resolve if the URL did not contain a file
    > name. I think I can know "IF" a file name was not on the URL. After the
    > request, is done, if the request URL has an ending slash, it the original
    > didn't have a file name.


    Ok, have a look at:

    ..GetResponseHeader("CONTENT-LOCATION")

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Nov 8, 2007
    #4
    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. James Dyer
    Replies:
    5
    Views:
    639
  2. Gaurav  Agarwal
    Replies:
    2
    Views:
    712
    Gaurav Agarwal
    Jan 31, 2005
  3. corejavagroups
    Replies:
    6
    Views:
    3,553
    Roedy Green
    Nov 21, 2005
  4. yogesh
    Replies:
    1
    Views:
    360
    Victor Bazarov
    Mar 14, 2007
  5. Pavils Jurjans
    Replies:
    3
    Views:
    173
    Pavils Jurjans
    Mar 18, 2005
Loading...

Share This Page