Is there any way to open RDP Connection window using jquery(client side) ?
My jquery code is given below,
$(function () {
$(".RDPLink1").live('click', function () {
var IPAddress = $(this).attr('id'); // ip or name of puter to connect
$.ajax({
type: 'post',
cache: false,
data: { strIPAddress: IPAddress },
url: '<%=Url.Action("OpenRDPWindow","Home") %>',
success: function (data) {
}
});
});
I call the Home controller method, name is OpenRDPWindow, like
public void OpenRDPWindow(string strIPAddress)
{
Process objProcess = new Process();
string exe = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
if (exe != null)
{
objProcess.StartInfo.FileName = exe;
objProcess.StartInfo.Arguments = "/v " + strIPAddress; // ip or name of puter to connect
objProcess.Start();
}
}
Actually my need is, When the user click the href link in my page, we need to open RDP Window based on IPAddress...
In my system using VS2010, it is working fine & it's open the RDP
Window based on IPAddress, because i wrote the code in Server side(C#)
to my system ...After i deploy the project in IIS, then user click the href link, the RDP(mstsc.exe) was running in Server machine(where i deploy my
application).But i need to open the RDP window in user machine (Client side)...
How do i solve this using jquery or javascript? (or) Is there any other way to solve this issue?
Thanks in advance....@@@
Is there any way to open RDP Connection window using jquery(client side) ?
My jquery code is given below,
$(function () {
$(".RDPLink1").live('click', function () {
var IPAddress = $(this).attr('id'); // ip or name of puter to connect
$.ajax({
type: 'post',
cache: false,
data: { strIPAddress: IPAddress },
url: '<%=Url.Action("OpenRDPWindow","Home") %>',
success: function (data) {
}
});
});
I call the Home controller method, name is OpenRDPWindow, like
public void OpenRDPWindow(string strIPAddress)
{
Process objProcess = new Process();
string exe = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
if (exe != null)
{
objProcess.StartInfo.FileName = exe;
objProcess.StartInfo.Arguments = "/v " + strIPAddress; // ip or name of puter to connect
objProcess.Start();
}
}
Actually my need is, When the user click the href link in my page, we need to open RDP Window based on IPAddress...
In my system using VS2010, it is working fine & it's open the RDP
Window based on IPAddress, because i wrote the code in Server side(C#)
to my system ...After i deploy the project in IIS, then user click the href link, the RDP(mstsc.exe) was running in Server machine(where i deploy my
application).But i need to open the RDP window in user machine (Client side)...
How do i solve this using jquery or javascript? (or) Is there any other way to solve this issue?
Thanks in advance....@@@
Share Improve this question edited Jul 26, 2012 at 12:48 Manikandan Sethuraju asked Jul 5, 2012 at 9:43 Manikandan SethurajuManikandan Sethuraju 2,89310 gold badges32 silver badges48 bronze badges 1- 1 your RDP is opening because your developer machine is the server when you debug, but when you deploy it to the server it opens the RDP on the server, not to the user who triggered it. – Rumplin Commented Jul 5, 2012 at 9:59
2 Answers
Reset to default 5 +500I followed the given below steps for solve this issue,
1) Jquery code is
$(function () {
$(".RDPLink1").live('click', function () {
var IPAddress = $(this).attr('id'); // ip or name of puter to connect
window.location.href="http://path/home/OpenRDP?address="+IPAddress ;
});
});
2) I created a new .aspx page & write given below server side(C#) code in GET Method(Page load) for solve this issue
[HttpGet]
public ActionResult OpenRDP()
{
string address = Request.QueryString["address"];
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", string.Format("attachment; filename={0}.rdp", address));
Response.Output.Write(string.Format(@"
screen mode id:i:2
session bpp:i:32
pression:i:1
keyboardhook:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
disable full window drag:i:1
allow desktop position:i:0
allow font smoothing:i:0
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:{0}
audiomode:i:0
redirectprinters:i:1
redirectports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
autoreconnection enabled:i:1
authentication level:i:2
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
drivestoredirect:s:E:;
use multimon:i:0
audiocapturemode:i:0
videoplaybackmode:i:1
connection type:i:2
redirectdirectx:i:1
use redirection server name:i:0", address));
Response.End();
return View();
}
It will open the RDP window from client's browser download option....
So, this is the one type of solution for this issue...
How do i solve this using jquery or javascript?
Wait a minute, you are opening a process on the server, not on the client puter. That's why your application doesn't work. For security reasons you cannot start processes on the client machine. Achieving this task through javascript only might be quite challenging. Companies such as LogMeIn
have implemented such interfaces, but there are years of work behind, not something that you might hope achieve in a couple of lines of code that someone will post you on Stack Overflow :-)
Some possibilities include using an ActiveX which obviously impose that you have control over your clients environment. Another possibility is to use a Silverlight 5 Out-Of-Browser application running in Full Trust which allows you to start processes on the client, but it obviously has the same limitation as the first solution, it's just that ActiveX is kinda obsolete technology now.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742309661a4419635.html
评论列表(0条)