AnyOne
AnyOne

Reputation: 931

App Relative path to physical path in ASP.NET

I simply try to convert "~/Telerik.Web.UI.WebResource.axd?imgid=310aa01d42ba47e1af090c60b520dd8e&type=rbi" this path to physical path.

I simply tried below code but it throws Exception and says "Illegal characters in path".

Server.MapPath("~/Telerik.Web.UI.WebResource.axd?imgid=310aa01d42ba47e1af090c60b520dd8e&type=rbi") 

I am not exactly sure it is possible to do that or not.

Edit: I actualy have RadBinaryImage That holds the url. I want to have byte array from RadBinaryImage and this is what i try to access file.

Upvotes: 1

Views: 1815

Answers (3)

Adrian Iftode
Adrian Iftode

Reputation: 15663

Telerik.Web.UI.WebResource.axd is not physical resource, so it hasn't an equivalent on disk. Probably is loaded/readed from a dll by its corresponding handler.

Upvotes: 0

Brad Christie
Brad Christie

Reputation: 101594

How about [control].ResolveUrl instead?

MapMath is looking for a file, which & is not accepted in a file path. You're just looking to get the "absolute URL" (or at least one that's folder agnostic) that the client can use.

Upvotes: 0

Daniel A. White
Daniel A. White

Reputation: 190897

Try

Server.MapPath("~/Telerik.Web.UI.WebResource.axd") + "?imgid=310aa01d42ba47e1af090c60b520dd8e&type=rbi)"

Upvotes: 1

Related Questions