ASP.Net:在一个共享/静态函数使用System.Web.UI.Control.ResolveUrl() [英] ASP.Net: Using System.Web.UI.Control.ResolveUrl() in a shared/static function

查看:150
本文介绍了ASP.Net:在一个共享/静态函数使用System.Web.UI.Control.ResolveUrl()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是在Asp.Net共享/静态函数使用RESOLVEURL()的最好方法?我对目前的VB.Net的解决方案是:

What is the best way to use ResolveUrl() in a Shared/static function in Asp.Net? My current solution for VB.Net is:

Dim x As New System.Web.UI.Control
x.ResolveUrl("~/someUrl")

或C#:

System.Web.UI.Control x = new System.Web.UI.Control();
x.ResolveUrl("~/someUrl");

但我知道这不是调用它的最佳方式。

But I realize that isn't the best way of calling it.

推荐答案

我用<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.virtualpathutility.aspx\">System.Web.VirtualPathUtility.ToAbsolute.

这篇关于ASP.Net:在一个共享/静态函数使用System.Web.UI.Control.ResolveUrl()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆