Ask a questionAsk a question
 

AnswerRequest.URI

Answers

  • Wednesday, November 04, 2009 9:48 AMbwc; Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Sonia,

    You can get the Page name in a number of ways. For me often the best way is Request.RawUrl (as Yi-Lun said before)

    Request.RawUrl will give you the full path:

    http://www.mywebsite.com/virtualDirectory/index.aspx

    the raw URL is

    /virtualDirectory/index.aspx
    • Marked As Answer bySonia Bansal Thursday, November 05, 2009 3:24 AM
    •  
  • Wednesday, November 04, 2009 2:22 PMTzafrirben Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    For the file name, you can use Request.FilePath if the URL is http://www.mywebsite.com/virtualDirectory/index.aspx the file path property is /index.aspx so you will to remove back slash
    • Edited byTzafrirben Wednesday, November 04, 2009 2:22 PMLooks bad with no new line
    • Marked As Answer bySonia Bansal Thursday, November 05, 2009 3:24 AM
    •  

All Replies

  • Wednesday, November 04, 2009 8:43 AMAnton Staykov Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,
    I don't see a reason that it would not work ;)
    But I can test in a jiffy and let you know for sure.

  • Wednesday, November 04, 2009 9:08 AMYi-Lun LuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello, until the port number issue is fixed, Request.Url.AbsolutePath will give a wrong port. To get the actual port number, please use:

    "http(s)://" + Request.Headers["Host"] + Request.RawUrl
    Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
  • Wednesday, November 04, 2009 9:30 AMSonia Bansal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Yi-Lun-Lo,

    I am only concerned with the PageName, so I think that will work perfectly in  Azure?
    Thanks, Sonia
  • Wednesday, November 04, 2009 9:48 AMbwc; Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Sonia,

    You can get the Page name in a number of ways. For me often the best way is Request.RawUrl (as Yi-Lun said before)

    Request.RawUrl will give you the full path:

    http://www.mywebsite.com/virtualDirectory/index.aspx

    the raw URL is

    /virtualDirectory/index.aspx
    • Marked As Answer bySonia Bansal Thursday, November 05, 2009 3:24 AM
    •  
  • Wednesday, November 04, 2009 12:27 PMSonia Bansal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for all your suggestions.
    Thanks, Sonia
  • Wednesday, November 04, 2009 2:22 PMTzafrirben Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    For the file name, you can use Request.FilePath if the URL is http://www.mywebsite.com/virtualDirectory/index.aspx the file path property is /index.aspx so you will to remove back slash
    • Edited byTzafrirben Wednesday, November 04, 2009 2:22 PMLooks bad with no new line
    • Marked As Answer bySonia Bansal Thursday, November 05, 2009 3:24 AM
    •  
  • Thursday, November 05, 2009 3:24 AMSonia Bansal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thanks :)


    Thanks, Sonia