-1

when I press an icon in my application, it automatically generates a file and opens its contents in the url in a new tab or current tab whichever way you look at it

https://BASEURL/config/dteg/vt2k/standard/vt2k-dev-standard.txt

I want to read in the full url and extract the last filename and store it in a string. Can you please help me?

Thank you

I haven't tried anything yet. Anything I have tried either gets the previous url in old tab or just simply gets the base url.

Hyper3146
  • 1
  • 4
  • Possible duplicate of [Get file name from URI string in C#](https://stackoverflow.com/questions/1105593/get-file-name-from-uri-string-in-c-sharp) – JeffC Apr 05 '19 at 19:37

1 Answers1

0

Found out what I was looking for. For everyone who don't know here is the code:

Uri uri = new Uri("https://BASEURL/config/dteg/vt2k/standard/vt2k-dev-standard.txt");
string lastSegment = uri.Segments.Last();
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Hyper3146
  • 1
  • 4