开发者

ResolveUrl in Static WebMethod

开发者 https://www.devze.com 2023-01-04 06:28 出处:网络
How do you开发者_如何学编程 resolve a url like \"../../images/test.png\" to \"http://yoursite.com/images/test.png\" in a static asp.net web method?Here is a blog entry from Rick Strahl that might help

How do you开发者_如何学编程 resolve a url like "../../images/test.png" to "http://yoursite.com/images/test.png" in a static asp.net web method?


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


look in HttpContext.Current.Request


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号