0

I have an identity impersonate setting on webconfig. I am trying to connect to the exchange mail server from c# but instead of using identity impersonate from web.config, the runspace.open() command uses identity from application pool. And ends up giving me access denied error.

I have checked the identity impersonate is working for that page.

If i put the same credentials as web.config impersonate on applications pool identity, then it works but I dont want the whole application to run using that credential. I want to run just the single page that connects to mail server using the identity in web.config?

My problem is similar to the unsolved problem here.

http://forums.asp.net/p/1771787/5554766.aspx?Re+net+and+remote+powershell+sessions

Can anyone help me?

dtksmsl
  • 239
  • 4
  • 14
  • .NET version, Windows version, IIS version? Please remember to include this kind of info when asking questions. Thanks. – Kev Nov 08 '13 at 16:43
  • .NET version 4.5. Windows: Windows Server 2008 R2 Enterprise SP 1 IIS version 7.5.7600.16385 – dtksmsl Nov 08 '13 at 16:56

1 Answers1

0

Does the account you're impersonating have RBAC permssions granted in Exchange?

mjolinor
  • 66,130
  • 7
  • 114
  • 135
  • Yes, the user is a member of following security groups: CN=Organization Management,OU=Microsoft Exchange Security CN=Exchange Organization Administrators,OU=Microsoft Exchange Security Groups – dtksmsl Nov 08 '13 at 16:52
  • Also I doubt it is a server issue because, i can connect to the mail server using the remote powershell (from powershell) from the web server. It has to be IIS or my c# code. – dtksmsl Nov 08 '13 at 16:54