开发者

How do i copy files to virtual path at run time

I am loading a user control dynamically like below

User开发者_Python百科Control objUserControl = (UserControl)this.LoadControl("~/UserControls/ucProfileViewDefault.ascx");

Now I have another user control file ucProfileViewSMSIS.ascx which is located in some other location . I need to copy this file to my virtual path at run time and then load it like below

UserControl objUserControl = (UserControl)this.LoadControl("~/UserControls/ucProfileViewSMSIS.ascx");

How do i do this ?


Server.MapPath and Page.ResloveUrl will get you the location, then you can move it and load:

var path = Server.MapPath(Page.ResolveUrl("~/UserControls/ucProfileViewSMSIS.ascx"));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜