I have add reference to Micosoft.word dll in my project.This is the code:
Object missing=System.Reflection.Missing.Value;
Object filename="D:\\DocFiles\\myfile.doc";
object readOnly = false;
object isVisible = true;
Word.ApplicationClass oWordApp= new ApplicationClass();
Word.Document oWordDoc=oWordApp.Documents.Add(ref missing,ref missing, ref missing,ref missing);
oWordDoc.Activate();
oWordApp.Selection.TypeText("This is the text");
oWordApp.Selection.TypeParagraph();
oWordDoc.SaveAs(ref filename,ref missing,ref missing,ref missing,
ref missing,ref missing,ref missing,ref missing,ref missing,
ref missing,ref missing,
ref missing,ref missing,ref missing,ref missing,ref missing);
oWordApp.Application.Quit(ref missing,ref missing, ref missing);
but it is giving me error:
Access is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 50: object isVisible = true;
Line 51: object missing = System.Reflection.Missing.Value;
Line 52: Word.ApplicationClass oWordApp = new Word.ApplicationClass();
Line 53:
please

tell me what is the solution.Should It requires some IIS settings?