Problem on Opening OutLook Express using ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sivisr
    New Member
    • Jan 2007
    • 17

    Problem on Opening OutLook Express using ASP.NET

    Hi,
    i am using the following code to open outlook Express to send mail ,but i get

    " System.Unauthor izedAccessExcep tion: Access is denied. at WebApplication7 .WebForm9.Butto n1_Click(Object sender, EventArgs e) in c:\inetpub\wwwr oot\webapplicat ion7\outlookfrm .aspx.cs:line 57 " this error.

    My code:
    Outlook._Applic ation app = null;
    Outlook._NameSp ace nameSpace = null;
    Outlook.MailIte m memo = null;
    Outlook.MAPIFol der outbox = null;
    try
    {
    app = new Outlook.Applica tionClass();
    nameSpace = app.GetNamespac e("MAPI");
    nameSpace.Logon (null,null,fals e, false);
    outbox = nameSpace.GetDe faultFolder(Out look.OlDefaultF olders.olFolder Drafts);
    memo = (Outlook.MailIt em)app.CreateIt em(Outlook.OlIt emType.olMailIt em);
    memo.To = "wf.tl@recordsa nddata.com";
    memo.Subject = "TechRepublic.c om Test";
    memo.Body = "Hello there";
    memo.SaveSentMe ssageFolder = outbox;
    memo.Send();
    }
    catch(System.Ex ception ex)
    {
    Response.Write( ex.ToString());
    }

    Any Body Please give me any suggesion or any other option for opening outlook.
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    In Which account you are running your application ? An account with admin rights ?

    Means, did you make Impersonate to TRUE in web.config file and with a valid Domain Username and Password ?

    Comment

    • sivisr
      New Member
      • Jan 2007
      • 17

      #3
      ya every thing is good but there is a problem in out look,its is not opening in my system.

      thank you

      Comment

      Working...