Developer Forum »
Server.MapPath in OnAfterUpdate etc.
20 posts

On a traditional Asp.net site I usually do Server.MapPath in order to get the physical path of a website.

This works fine in the Template files of Webnodes - but not in the methods of generated WAF_Custom files since  OnAfterUpdate etc. are executed by (Workflow?) threads without any HttpContext.

So my question is - how can I find the physical path in OnAfterUpdate() method?

I've looked around in WAF.Engine.WAFRuntime - but I haven't been able to locate it.. :)

 

/Njål

 

UPDATE: I was able to use WAFRuntime.ContextSession.Engine._startupLocalPath 

120 posts

Use: WAF.Presentation.Web.WAFContext.PathFromRootToAppFolder

This property is available in all thread contexts!

Ole

20 posts

Thanks!!

 

/N

36 posts

I also wonder if there is a method to get the website root URL in the workflow context. I know its not web context so if I want any web-related stuff there I would need to pass it (e.g. when triggering a workflow from web app context). In my scenario the workflow will be run by the webnodes scheduler.

120 posts

Hi,

WAFContext.PathFromRootToAppFolder

Should work in any context, also workflow.

1