Currently we have a solution that grabs the filename from the URL using this
currentFile = Path.GetFileNameWithoutExtension(url);
We found that if there are query strings attached that include characters such as quotes it returns with an error of Illegal characters in path.
For example if the url is
http:\\myurl.com\mypage.aspx?utm_content=This+Is+"Broken"
Then it won't get the filename. Is there a better, cleaner way to get "mypage"?
use this: Uri.AbsolutePath
Request.Url.AbsolutePath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With