简体   繁体   English

如何使用html提交按钮调用C#Windows表单?

[英]How can i call c# windows form with html submit button?

I have a windows form. 我有一个Windows窗体。 And i want to make a login page in html. 我想用html制作登录页面。 In hmtl page user should type correct name and password then press button. 在hmtl页面中,用户应输入正确的名称和密码,然后按按钮。 After submit button i want to open my c# windows form application. 提交按钮后,我想打开我的C#Windows窗体应用程序。 How can i handle this issue ? 我该如何处理这个问题?

Login page : 登录页面:

<!DOCTYPE html>
<head><title>Login Screen</title></head>

<form action="?????" method="GET">
UserName: <input type="text" name="name"><br/>
Password: <input type="text" name="pwd"><br/>
<input type="submit" name="submit" value="submit">
</form>

</html>

And i want to call my frmEntr.cs form. 我想打电话给我的frmEntr.cs表格。 Could anyone help me ? 有人可以帮我吗?

You can't open a windows form application from a browser without plugins. 如果没有插件,则无法从浏览器打开Windows窗体应用程序。 You might want to rethink your design. 您可能需要重新考虑您的设计。

You can't open a windows form application from a browser. 您无法通过浏览器打开Windows窗体应用程序。 You have to rethink on what you are want to do. 您必须重新考虑要做什么。

I think you want to perform login logic from windows application which is already implemented. 我认为您想从已经实施的Windows应用程序执行login逻辑。 all what you need to do is to create a web service with login logic and call it from your web application, Or create Api with authentication logic in it then call it from your web application. 您所需要做的就是创建一个具有登录逻辑的Web服务,然后从您的Web应用程序中调用它,或者在其中创建带有身份验证逻辑的Api,然后从您的Web应用程序中对其进行调用。

When the client installs the win forms application you need to register an URI scheme to it. 客户端安装Win Forms应用程序时,您需要向其注册一个URI方案。 Lets say you register "myApp". 假设您注册了“ myApp”。 After the user presses submit you need to simulate an on click on a <a href="myApp:params"> . 用户按下提交后,您需要模拟<a href="myApp:params">上的点击。

This will be similar to a mailto scheme . 这将类似于mailto方案

Read how to register an uri scheme to an application . 阅读如何将uri方案注册到应用程序

It appears to me that you are trying to have an interaction between javascript code in html and c# code in the container. 在我看来,您正在尝试在html中的javascript代码和容器中的c#代码之间进行交互。 In this case, you should be able to use javascript's window.external.externalMethod() to externalMethod() in c#. 在这种情况下,您应该能够在c#中将javascript的window.external.externalMethod()用作externalMethod()。

The syntax should be something like this: 语法应该是这样的:

<input type="button" value="blah" onclick="window.external.externalMethod();" />

If you want to open the windows application, you must use the activex. 如果要打开Windows应用程序,则必须使用Activex。 The solution should be like this: C#制作、打包、签名、发布Activex全过程 解决方案应如下所示: C#制作,打包,签名,发布Activex全过程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 c# 更改 windows 中的按钮名称 - How can I change a button name in windows form c# 如何在C#的其他类中调用Windows窗体元素 - How can I call my windows form elements in my other class in C# 如何在Windows窗体中将.png文件用作按钮? (在C#中 - visual studio 2013) - How can I use a .png file as a button in Windows Form ? ( in C# - visual studio 2013 ) 如何在我的 C# Windows 窗体中制作重置按钮? - How can I make a reset button in my C# Windows Form? 在 C# 中,如何在单击 Windows 窗体中的按钮后将某些内容打印到控制台? - In C#, how can I print something to the console after clicking a button from Windows Form? c#如何在html通用控件中调用图像按钮的单击事件? - c# how can i call click event of image button in html generic control? 使用C#提交HTML表单提交 - Submit an HTML form submit using C# 我如何在C#Windows窗体应用程序中的Webbrowser控件中显示存储的html代码,而不在硬盘上创建html文件? - How can i display stored html codes in webbrowser control in C# windows form application without creating html files on hard drive? 如何在 Windows 窗体 c# 中限制 DatetimePicker? - How can I limit DatetimePicker in windows form c#? 如何随机化图纸 C# Windows 表格应用程序? - How can I randomise drawings C# Windows Form Aplication?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM