This project has moved. For the latest updates, please go here.

Owin.Testing and HttpContext.Current

Feb 24, 2014 at 4:40 PM
I wrote an integration test for a file upload controller. In that controller I want to get the path to the App_Data folder like that:

var path = HttpContext.Current.Server.MapPath("~/App_Data/");

HttpContext.Current is null when hosting the server with Owin.Testing. Am I missing an alternate method to get the App_Data folder or is this just not possible when using Owin.Testing?
Mar 3, 2014 at 6:38 PM
App_Data is an ASP.NET construct. Ms.Owin.Testing operates completely in memory, there is no ASP.NET involved. If you need to find out where your app is loaded from, consider AppDomain.CurrentDomain.SetupInformation.ApplicationBase.
Mar 5, 2014 at 10:14 AM
Thanks for the help - I solved it differently: I'm using Azure Storage (Emulator) now instead of saving files locally. So I don't need the App_Data path anymore.