asp.net mvc - Get physical of the root of the website from inside a class? -
hi,
i have mailhandler class in mvc webapplication , needs physical path mailtemplate file (a couple of folders down root). how do this? have send in kind of httpcontext? mailhandler singelton there no constructor parameters :
public static emailhandler instance { { if (emailhandler._emailhandler == null) emailhandler._emailhandler = new emailhandler(); return emailhandler._emailhandler; } set { emailhandler._emailhandler = value; } }
any idea?
personally, tell base-path use; same code can work in number of environments, not web. if web-bound, httpcontext.current may help. if want pass in, instead pass in abstracted httpcontextbase, ala mvc.
but passing in string of base-path lot easier :)
Comments
Post a Comment