Everyone I am using C#.NET for the task. Let me explain briefly what i need actually. I have a WEB application in ASP.NET C# and the value/data inserted by the user in the 'TextBox'(Employee_name:) needs to be passed to desktop application on the same corresponding 'TextBox' say "Employee_name:" So how do i make it. Thanks.
我使用c#的每个人。净的任务。让我简单地解释一下我到底需要什么。我在ASP中有一个WEB应用程序。NET c#和用户在“TextBox”(Employee_name:)中插入的值/数据需要被传递到与之对应的“TextBox”上的桌面应用程序,比如“Employee_name:”,那么我该怎么做呢?谢谢。
3 个解决方案
#1
1
Web applications can not initiate a communication. So you can't do this the way you'd (probably like).
Web应用程序不能发起通信。所以你不能用你喜欢的方式来做。
You can have your desktop application call a method in you ASP.NET application and get back the value and then put it in that required textbox.
您可以让桌面应用程序在您的ASP中调用一个方法。返回值,然后将其放入所需的文本框中。
However, that would mean a two step process Since you'd have to know when to ask the GUI application to go get the data from the ASP.NET application and depending on your situation, you'll probably have to pass additional information to the ASP.NET application so it can provide the value from the correct "record" as well.
但是,这意味着需要进行两步处理,因为您必须知道何时要求GUI应用程序从ASP获取数据。NET应用程序,根据您的情况,您可能需要向ASP传递其他信息。NET应用程序,这样它也可以从正确的“记录”中提供值。
EDIT Simple way to achieve this, using just regular Http request (no web services or WCF)
使用简单的Http请求(没有web服务或WCF)来编辑简单的方法来实现这一点
The Mark up in an .aspx file should have no html. Just the page directive like so:
aspx文件中的标记应该没有html。就像这样的页面指令:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="HttpTaskServer.WebForm1" %>
In your code behind file (.cs file of the page) you could do something like this:
在文件后面的代码中。你可以这样做:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.HttpMethod == "GET")
{
//Some parameter passed in by the client via QueryString (url)
var id = Request.QueryString["id"];
string data = GetTheData(id);
Response.Write(data);
}
}
}
For an example of how to make an http call from a GUI/Console application. Take a look at Code Listing 9 (the last code listing in the blog post). the link below will take you straight to code listing 9 http://www.matlus.com/httpwebrequest-asynchronous-programming/#codelisting9
关于如何从GUI/控制台应用程序进行http调用的示例。看一下代码清单9(博客文章中最后的代码清单)。下面的链接将直接指向清单9 http://www.matlus.com/httpwebrequest-异步编程/#codelisting9
#2
0
I suggest: - A webservice (WCF?) running on the IIS - A webservice consumer in the desktop
我建议:-一个在IIS上运行的webservice (WCF?) -一个桌面的webservice使用者
The desktop client polls the web server if he has something for him on a regular interval. That or use WCF to set up duplex communication. That way the server can inform his clients the textbox has been changed. The communication still needs to be initiated by the desktop client.
如果桌面客户端定期为web服务器提供某些内容,那么它将对web服务器进行轮询。或者使用WCF设置双工通信。这样,服务器就可以通知客户端文本框已经更改。通信仍然需要由桌面客户端发起。
#3
0
I assume the scenario you are referring to here is a Front end web application and backoffice windows application. I am not sure why would need the data to be passed in real time but my suggestion would be to get your operation from Web application completed/stored in Database and then have that data pulled from DB to your windows application.
我假设您在这里所指的场景是前端web应用程序和后台windows应用程序。我不确定为什么需要实时传递数据,但我的建议是,让Web应用程序完成/存储在数据库中,然后将数据从DB提取到windows应用程序。
#1
1
Web applications can not initiate a communication. So you can't do this the way you'd (probably like).
Web应用程序不能发起通信。所以你不能用你喜欢的方式来做。
You can have your desktop application call a method in you ASP.NET application and get back the value and then put it in that required textbox.
您可以让桌面应用程序在您的ASP中调用一个方法。返回值,然后将其放入所需的文本框中。
However, that would mean a two step process Since you'd have to know when to ask the GUI application to go get the data from the ASP.NET application and depending on your situation, you'll probably have to pass additional information to the ASP.NET application so it can provide the value from the correct "record" as well.
但是,这意味着需要进行两步处理,因为您必须知道何时要求GUI应用程序从ASP获取数据。NET应用程序,根据您的情况,您可能需要向ASP传递其他信息。NET应用程序,这样它也可以从正确的“记录”中提供值。
EDIT Simple way to achieve this, using just regular Http request (no web services or WCF)
使用简单的Http请求(没有web服务或WCF)来编辑简单的方法来实现这一点
The Mark up in an .aspx file should have no html. Just the page directive like so:
aspx文件中的标记应该没有html。就像这样的页面指令:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="HttpTaskServer.WebForm1" %>
In your code behind file (.cs file of the page) you could do something like this:
在文件后面的代码中。你可以这样做:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.HttpMethod == "GET")
{
//Some parameter passed in by the client via QueryString (url)
var id = Request.QueryString["id"];
string data = GetTheData(id);
Response.Write(data);
}
}
}
For an example of how to make an http call from a GUI/Console application. Take a look at Code Listing 9 (the last code listing in the blog post). the link below will take you straight to code listing 9 http://www.matlus.com/httpwebrequest-asynchronous-programming/#codelisting9
关于如何从GUI/控制台应用程序进行http调用的示例。看一下代码清单9(博客文章中最后的代码清单)。下面的链接将直接指向清单9 http://www.matlus.com/httpwebrequest-异步编程/#codelisting9
#2
0
I suggest: - A webservice (WCF?) running on the IIS - A webservice consumer in the desktop
我建议:-一个在IIS上运行的webservice (WCF?) -一个桌面的webservice使用者
The desktop client polls the web server if he has something for him on a regular interval. That or use WCF to set up duplex communication. That way the server can inform his clients the textbox has been changed. The communication still needs to be initiated by the desktop client.
如果桌面客户端定期为web服务器提供某些内容,那么它将对web服务器进行轮询。或者使用WCF设置双工通信。这样,服务器就可以通知客户端文本框已经更改。通信仍然需要由桌面客户端发起。
#3
0
I assume the scenario you are referring to here is a Front end web application and backoffice windows application. I am not sure why would need the data to be passed in real time but my suggestion would be to get your operation from Web application completed/stored in Database and then have that data pulled from DB to your windows application.
我假设您在这里所指的场景是前端web应用程序和后台windows应用程序。我不确定为什么需要实时传递数据,但我的建议是,让Web应用程序完成/存储在数据库中,然后将数据从DB提取到windows应用程序。