I just ran into a problem. Before I was getting the URL of the Page in Page_Init method. Now to load the css based on the page in the URL, I had to shift the method into the OnPreRender event.
HttpContext.Current.Request.RawUrl
But when I do so I m not able to get the page url. All I get is “Page-Not-Found.aspx”.
Is there a way to get the URL in OnPreRender Method?
Thanks
Check ASP.net Page Life Cycle
In the start step, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. Additionally, during the start step, the page’s UICulture property is set.
It is working fine and Request object is created at my side..