Click here to Skip to main content
15,667,356 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have an application developed in Here i am trying to send data from my application(hosted in IIS) to another web application(local machine). Its working fine while i used to run the application in visual studio development server but getting access denied issue while running from IIS. Below is my code.

Thanks in advance.

int iHandle = NativeWin32.FindWindow(null, "Application name to send the data");
System.Windows.Forms.SendKeys.SendWait("some value");//Here i am getting Access denied issue while running in IIS
System.Windows.Forms.SendKeys.SendWait("some value");
Sinisa Hajnal 8-Dec-14 2:16am    
What are you trying to do? Maybe there is different way to accomplish this...

1 solution

When you run your web site from within Visual Studio you use your local account, that has probably more access right,even administrator...
Inside the IIS the user context for your site is different - this is the user defined on the site or on the pool the site runs in...That user by default is a very weak user that can't do a lot of things inside the system (the reason of course is security).
Apparently the user has no right to send WM messages to external processes...
You have two options:
1. The preferred way is to review your design - it is a very bad idea to talk between two applications the way you described, but it even worst when one of the applications is a web site...
2. Switch user on the site/pool to one with enough rights to send WM messages...
Share this answer
Vanja Lukovic 23-Nov-22 16:51pm    
Yes but I am not sure how to switch user/pool. I tried to switch many App pools but without success.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900