// create a FoxPro business object dynamic entry = fox.ComHelper.CreateObject("blog_entry"); // Call Load() method on FoxPro business object if (!entry.Load(id)) throw new ApplicationException("Invalid Id passed.");>Have you looked at http://www.west-wind.com/presentations/AspNetFoxProRevisited.pdf?
>>dynamic FoxObject = Activator.CreateInstance(Type.GetTypeFromProgID("MyFoxPro.COMObject")); >>>>This works great, except when it comes to errors that occur inside the FoxPro object. COMReturnError() (or no error handler at all) doesn't return the specified info, but rather generates the following error in .NET:
>> [ComVisible(true)] >> public class DotNetCallback >> { >> >> // COMReturnError() doesn't work the way we are handling method calls, so use callback instead >> public void ThrowException(string ExceptionText) >> { >> throw new Exception(ExceptionText); >> } >> } >>>>I pass the callback object to FoxPro, then call the ThrowException() method from FoxPro, rather than COMReturnError(). The problem is that the exception comes back to FoxPro rather than interrupting the currently running ASP.NET MVC request. That's probably exactly what it should do, but then besides an Exception, how else can I interrupt running code in ASP.NET and report the error? Would a redirect do the trick, or will the remaining code in the interrupted method finish running?