我想将导出的pdf文件存储到剪贴板,以便能够作为附件粘贴到Outlook中。我正在使用asp.net / vb,并且尝试在我的Web应用程序中导入system.windows.forms以使用剪贴板类。
有什么主意吗?
'here's my code:
Clipboard.SetDataObject(System.IO.Path.Combine("C:/Temp/",HttpContext.Current.Session("fileName")),True)
'this is the error after this process:
Exception thrown: 'System.Threading.ThreadStateException' in System.Windows.Forms.dll
An exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll but was not handled in user code
Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.