Daniel Brink
Daniel Brink

Reputation: 2504

ResolveUrl in Static WebMethod

How do you resolve a url like "../../images/test.png" to "http://yoursite.com/images/test.png" in a static asp.net web method?

Upvotes: 3

Views: 5224

Answers (3)

Derek Wade
Derek Wade

Reputation: 746

I was able to use the current Context and application paths together:

    Uri uri = new Uri(HttpContext.Current.Request.Url,
                System.IO.Path.Combine(HttpContext.Current.Request.ApplicationPath,
                "Reports/CareerDev.aspx"));
    return uri.AbsoluteUri;

Upvotes: 0

Daniel Dyson
Daniel Dyson

Reputation: 13230

Here is a blog entry from Rick Strahl that might help: http://www.west-wind.com/weblog/posts/154812.aspx

Upvotes: 8

Sergej Andrejev
Sergej Andrejev

Reputation: 9413

look in HttpContext.Current.Request

Upvotes: 1

Related Questions