locked
HttpWebRequest Uri problem RRS feed

  • Question

  • User1135050801 posted

    Hi All - sorry for putting this post here, I didn't know where else to it...

    I'm trying to use HttpWebRequest to get the contents of another page on the server - it's actually an aspx page that acts as a gateway to some legacy mainframe...  If I call WebRequest.Create() with a fully qualified URL (http://blahblah....) it works fine.  But I don't want to specify a fully qualified URL - I want to specify something relative to the page I'm on.  I've tried the usual "./" and "~/", but I keep getting "Invalid URI: The format of the URI could not be determined."  Obviously, it wants a fully qualified URL/URI...  Is there any way I can get that?  Perhaps from he Request object?  That is short of building it one piece at a time from the Request object....  Thanks!  --- Curt

     

     

     

    Wednesday, January 10, 2007 8:06 AM

Answers

  • User113421904 posted

    Hi All - sorry for putting this post here, I didn't know where else to it...

    I'm trying to use HttpWebRequest to get the contents of another page on the server - it's actually an aspx page that acts as a gateway to some legacy mainframe...  If I call WebRequest.Create() with a fully qualified URL (http://blahblah....) it works fine.  But I don't want to specify a fully qualified URL - I want to specify something relative to the page I'm on.  I've tried the usual "./" and "~/", but I keep getting "Invalid URI: The format of the URI could not be determined."  Obviously, it wants a fully qualified URL/URI...  Is there any way I can get that?  Perhaps from he Request object?  That is short of building it one piece at a time from the Request object....  Thanks!  --- Curt

    Hi,

    "Invalid URI: The format of the URI could not be determined."  WebRequest.Create() don't support this kind of URI.

    You can try put the common part of URI in a string variable and concatenate the relative path and pass it to the Create() method.

    hope it helps!

     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 11, 2007 2:26 AM