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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -