Solved

Source Code to connect Outlook from ASP.Net Web Application

Posted on 2004-04-28
8
1,376 Views
Last Modified: 2007-12-19
Hi,

I am looking for a source code to read contacts in Outlook from a Web application written in C#.

I have no problem to write a program in C# Windows form that access outlook.

But when I do the same programming code in a web application, the web application doesn't work for authorizations reasons.

Can you help me to solve this problem?

Thank you very much,

Olivier
0
Comment
Question by:olivierverdin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:iclemartin
ID: 10943879
Is your website using authentication or anonymous access? If anonymous then your code is trying to establish a MAPI session using the account assigned (IUSR_*).

One way to fix this is change the anonymous user to a new account. Log into this new account and set up a default email profile.
0
 
LVL 5

Expert Comment

by:danielsonchris
ID: 10943972
After reading your question the first thing that came to mind was a program I wrote in C++ a few years back that I ended up using tokens to elevate my user levels.  With that said, I was curious how I'd do that in .Net without having to use the Interop.  Here is a pretty sweet link... I think you may find what you need in this page.  

http://msdn.microsoft.com/msdnmag/issues/01/11/security/default.aspx

Best regards,
Chris
0
 
LVL 1

Expert Comment

by:jangeador
ID: 10945814
What you need to do is to enable impersonation in the web config. I had a similar situation and I created an account with the proper permissions in the domain, and then I used forms based security because once they passed the security they have the proviledges of the impersonated user.

Create your user and then add this line to your web.config

<identity impersonate="true"
          userName="domain\user"
          password="password" />

Remember that once your users are on your application they will execute their code with the user credentials. If you want to force each user to use their own credentials then only use this line:

<identity impersonate="true" />

I had to use a user account because the things I wanted my users to do required elevated privileges that I did not want to give them, so I just had them impersonate as a user with those privileges.

Hope this helps,

jangeador
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:jangeador
ID: 10945825
Oh, one more thing, if you use impersonation you need to turn on one of the authentication methods in IIS, either Basic Challenge Response, or Integrated Windows Security.
0
 

Author Comment

by:olivierverdin
ID: 10946903
I need to force each user to use their own credentials so I will use <identity impersonate = "true" />

but how do you turn on one of the authentication methods in IIS?  I did'nt find these options in IIS.

Thanks for your help,

Olivier
0
 
LVL 1

Accepted Solution

by:
jangeador earned 500 total points
ID: 10950478
In the IIS management right click on your site, then go to properties, then go to the "Directory Security" tab, and then under the "Anonymous Access and Authentication Control" you can find the options mentioned above.

Just remember, by default all processes run under the LocalServer\ASPNET account. you need to ensure that all your users belong to a security group which has access to all the resources on your site, such as sql server or any other resource.

Here is a good article that perhaps you should check out.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconImpersonation.asp
0
 

Author Comment

by:olivierverdin
ID: 10952820
Ok, I will read this article and try to understand.

I changed the authorizations of IIS.  Now the application is not crashing but it is waiting for the response of the web server and it stays like this forever!

Any idea of the problem?

Thanks,

Olivier
0
 
LVL 1

Expert Comment

by:jangeador
ID: 10953556
I will try to put a user information in the impersonation line just to test it. I am really not sure what information is waiting for. have you tried debugging to see which line is getting stuck on?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Six Sigma Control Plans
Introduction to Processes

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question