I am developing a proof of concept for a web application: a web page with a button that opens a Word application installed on a user's PC.
I am stuck in a C # project in Visual Studio 2008 Express (Windows XP client, LAMP server). I followed the Writing ActiveX Control in .NET and after some tweaking it worked fine. Then I added a button to open Word.
The problem is that I can reference Microsoft.Office.Interop.Word from the project, but I cannot access it from the web page. The error says: "This assembly does not allow partially trusted subscribers."
I read a lot about security in .NET, but now I'm completely lost. Disclaimer: I have been in .NET since 4 days ago.
I tried to get around this problem, but I do not see the light! I donโt even know if itโs ever possible!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Word = Microsoft.Office.Interop.Word; using System.IO; using System.Security.Permissions; using System.Security; [assembly: AllowPartiallyTrustedCallers] namespace OfficeAutomation { public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } private void openWord_Click(object sender, EventArgs e) { try { Word.Application Word_App = null; Word_App = new Word.Application(); Word_App.Visible = true; } catch (Exception exc) { MessageBox.Show("Can't open Word application (" + exc.ToString() + ")"); } } } }
Ando source share