I have got image url path like :
http://localhost:3810/images/test.png
What I am looking is to split the path and just get the path for instance : /images/test.png using razor.
Any help or suggestion will be appreciated
I have got image url path like :
http://localhost:3810/images/test.png
What I am looking is to split the path and just get the path for instance : /images/test.png using razor.
Any help or suggestion will be appreciated
You can use the Uri class like this:
@{
Uri uri = new Uri("http://localhost:3810/content/images/thumbs/0000019.png");
string path = uri.PathAndQuery;
}
The path
variable will be /content/images/thumbs/0000019.png
.