Home > , > Class檔使用"Server.MapPath"的方法

Class檔使用"Server.MapPath"的方法

2009年1月28日星期三

一般新增aspx檔打"Server.MapPath"是可以作用的
但是如果新增放在App_Code裡的Class檔,打"Server.MapPath"是沒有作用的
要如何讓Class檔裡有"Server.MapPath"的方法呢..
step1:在Class檔裡要先using System.Web;
step2:利用HttpContext.Current.Server.MapPath就可以使用了

參考網址:
http://www.eggheadcafe.com/community/aspnet/17/10022310/class-library-does-have-.aspx

0 Responses to "Class檔使用"Server.MapPath"的方法"