Getting aspx filename in Http Request
-
Hi, I’m trying to get the aspx file name from the Http Request i.e. Default.aspx. All I need is just FileName.aspx. Any ideas please? Regex? Or is there an alternative solution? Thanks. R
-
Hi, I’m trying to get the aspx file name from the Http Request i.e. Default.aspx. All I need is just FileName.aspx. Any ideas please? Regex? Or is there an alternative solution? Thanks. R
-
Use the following code to get file name from URL of the page url = Request.Url.ToString pageName = url.Substring(url.LastIndexOf("/") + 1)
Lets work it Out.........!
Thank you for your reply. I found another solution too.. I first got my "filepath" string from the Http Request and then by using it the following way:
string filename = Path.GetFileName(filepath)
This also seems to work rather nicely. R.