Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I developed an application in asp.net c # I use RDP with MSTSC protocol. But the hosting server is medium trust level and the protocol is as full trust and when the application process is a permission error as below message:

The application attempted to perform an operation not allowed by the security policy.

Well, this problem is because, as I said, the server is medium trust and MSTSC is full trust.

this is the code that is in the application

Process rdcProcess = new Process(); string executable = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe"); if (executable != null) { rdcProcess.StartInfo.FileName = executable; rdcProcess.StartInfo.Arguments = "/v:186.231.96.9:2020"; var sspw = new SecureString(); foreach (var c in txtPWD.Text) sspw.AppendChar(c); rdcProcess.StartInfo.Password = sspw; rdcProcess.StartInfo.LoadUserProfile = true; rdcProcess.StartInfo.UseShellExecute = false; rdcProcess.Start(); }

Is there any parameter to configure mstsc for medium trust?

please I'll appreciate your help!

Thanks a lot!

Bruno
Posted
Comments
Richard Deeming 7-Aug-14 13:12pm    
Why are you trying to start a Remote Desktop session *ON THE SERVER* where nobody will be able to see it?
YagoBruno 7-Aug-14 13:22pm    
Remote access is for the user to access outlook on the server company
Richard Deeming 7-Aug-14 13:51pm    
Your code is executing ***ON THE SERVER***. It will try to start the "mstsc.exe" process ***ON THE SERVER***. The user will never see the Remote Desktop session, because it's running ***ON THE SERVER***.

The only way this will ever work is if you use the Remote Desktop ActiveX control. This means that your users *must* be running Internet Explorer, and they *must* enable ActiveX controls.

MSDN has more details: http://msdn.microsoft.com/en-us/library/aa383541%28v=vs.85%29.aspx[^]
YagoBruno 7-Aug-14 14:01pm    
Richard,
It is as follows:
This is a web-site where my client has a restricted area for external employees of the company to access the company server.

It happens that the site is hosted in the provider Locaweb and this provider, your security level is medium trust and MSTSC is with full trust level.

site: www.systech-ac.com

Thanks!
Richard Deeming 7-Aug-14 14:05pm    
Yes, I understand that your code running ON THE SERVER is running in medium trust.

What I'm trying to explain to you is that, if you open a Remote Desktop session ON THE SERVER, the user will never see it.

You have to open the remote desktop session ON THE CLIENT, which means using client-side script and the ActiveX control.

You cannot execute code ON THE SERVER and expect it to start a program ON THE CLIENT.

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