When user requests http://localhost/WebApp1/Default.aspx
, txtApplicationPath.Text
should be assigned “/WebApp1”
, while txtAbsolutePath.Text
should be assigned “http://localhost/WebApp1/Default.aspx”
, but instead both textboxes display empty strings.
Why?
Default.aspx:
<asp:TextBox ID="txtApplicationPath" runat="server"
Text='<%# HttpContext.Current.Request.ApplicationPath %>'>
</asp:TextBox> <br />
<asp:TextBox ID="txtAbsolutePath" runat="server"
Text='<%# HttpContext.Current.Request.Url.AbsolutePath %>'>
</asp:TextBox>
thank you