Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Office > Visio

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 11-29-2005, 08:41 AM
Novice
 
Join Date: Nov 2005
Posts: 1
deenet
Default POSTED IN SEVERAL FORUMS..Help please

Hi


I am trying to automate visio 2003 from a web application.I am using the Visio Interop to talk to the Visio application from my C#.NET code.
The code is as follows

===============================================

using Visio=Microsoft.Office.Interop.Visio;

Visio.ApplicationClass A = new Microsoft.Office.Interop.Visio.ApplicationClass();

Visio.Document AddedDocument;
Visio.Documents visioDocuments;
Visio.Page AddedPage;
Microsoft.Office.Interop.Visio.Document stencil;
Microsoft.Office.Interop.Visio.Master masterInStencil;
Microsoft.Office.Interop.Visio.Shape StartShape;
Microsoft.Office.Interop.Visio.Shape EndShape;

AddedDocument =A.Documents.Add("C:\\Program Files\\Microsoft Office\\Visio11\\1033\\SITPLN_M.VST");

visioDocuments= A.Documents;
AddedPage=A.ActivePage;
stencil = visioDocuments["ANNOT_M.VSS"];

masterInStencil =stencil.Masters.get_ItemU("Ceiling");



// This is just the connection part...Pasted it for continuity...The above code is the important one

double pinXInternal=820.676;
double pinYInternal=799.900;

StartShape=AddedPage.Drop(masterInStencil,pinXInte rnal,pinYInternal);
StartShape.Text="Start Shape";
EndShape= AddedPage.Drop(masterInStencil, pinXInternal - 300 , pinYInternal );

EndShape.Text="End shape";

DynamicConnector D= new DynamicConnector();
D.ConnectWithDynamicGlueAndConnector(StartShape,En dShape);

AddedPage.DrawRectangle(800,800,1000,1000).Text="R ectangle";

AddedDocument.SaveAs("C:\\Deepak\\NewWindowsDoc.vs d");

A.Quit();


===============================================
(I plan to initialize the Application class in Global.asax in the future)

The problem is this..This code works fine when i run it from a Windows app( the diagram gets created and saved )..however it chokes when i run it from a web app.I get a RUN TIME error which says

Server execution failed


I am using impersonation.I have also added all the identities that ASPNET could take (as far as I know) MACHINENAME/ASPNET,MACHINENAME?IUSR_MACHINENAME,NETWORK,NETWOR K USER( They din work I got Access Denied Error...and finally when nothing worked...i impersonated!!
It worked) BUt now..i get this new run time error.


The error shows up on the line that I initialize my Application class object

Visio.ApplicationClass A = new Microsoft.Office.Interop.Visio.ApplicationClass();

Like I said...the same code runs perfectly when I run it from a windows application.
PLEASE HELP ME.I can see I need to do some configuration settings.Not sure what I need to do.I searched around in many forums...but could not find anything on this.Any help would be highly appreciated.

Thanks
deenet
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -7. The time now is 11:25 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft