从C#打开一个asp.net项目 [英] open a asp.net project from C #

查看:122
本文介绍了从C#打开一个asp.net项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我要为一家拥有用户和票务管理并且部分参与并且无法取得进展的公司做一份工作,所以我决定来寻求您的帮助.我要登录的是C#中未注册共享的用户和用户,以及ASP.net中所有管理和监督的部分,问题是我不知道如何在C#和ASP.net之间建立连接,的确,我不知道是否可以这样做.我要问的是,如果您能告诉我并教给我一些如何达到我想要的提示的信息,我对此没有任何代码,我曾尝试过但没有达到目标,但上面已对这个想法进行了解释.
提前ty

Hello, I have a job to do for a company that I have users and tickets management and stood in a part and can not progress, so I decided to come ask for your help. What I want is to log in and users of unregistered shares in C # and all the parts of administration and supervision in ASP.net, the problem is that I do not know how can i make the connection between C # and ASP.net, indeed I do not know if it is possible to do so. What I ask is that if you can tell me and teach me some clue how to get to that I want, I have no code about it, i tried but i didnt reach the goal, but the idea is explained above.
ty in advance

推荐答案

我从问题中了解到的是,您想知道是否可以统一使用ASP.NET和某些现有C#代码. br/>
ASP.NET网站实际上使用C#作为编程语言(也可以选择VB)

ASP.NET做脚本部分,该部分将由框架翻译成相应的HTML.实际的业务逻辑大部分是用C#编写的.

因此,您可以将现有的C#代码包装在某些逻辑类中,这些逻辑类对于应用程序域是有意义的,并且也许将其放在类库中.您可以从ASP.NET网站使用此类库,只需添加对其的引用即可.

我希望我对这个问题的理解是正确的.如果没有,请让我知道,我将尝试完善答案.
What i understood from the question is that you want to know whether it is possible to use ASP.NET and some existing C# code in unison.

ASP.NET websites actually use C# as the programming language(VB is also a choice)

ASP.NET does the scripting part which will will be translated to the respective HTML by the framework. the actual business logic is mostly written in C#.

So you can wrap your existing C# code in some logical classes that makes sense as per the application domain and perhaps put it inside a class library. You can use this class library from a ASP.NET website just by adding reference to it.

I hope my understanding of the question is correct. If not please let me know and I will try to refine the answer.


由于ASP.NET是基于.NET CLR的Web框架和平台,而C#是.NET语言,因此您可以用C#编写ASP.NET,最好说 Web应用程序 Windows应用程序,因为您可能会混淆其中的一个.根据您的澄清,您想从Windows应用程序控制(某种)Web应用程序.
A)最好的方法是发布Web服务或wcf服务,并从Windows应用程序中使用它们.
如果您无法添加此功能,则可以通过以下方式在两个应用程序之间交换数据:
B1)通过COM自动执行浏览器(Internet Explorer)-您将必须编写接口代码
B2)使用WebBrowser控件-但您必须编写浏览器功能的代码
C)使用HttpClient类-注意,您必须模拟浏览器操作和客户端代码的逻辑
D)其他一些IPC-甚至可以编码
As ASP.NET is a web framework and platform over .NET CLR, and C# is a .NET language and you can do ASP.NET in C#, you better say web application and windows application, because you might confuse one. According to your clarification, you want to control (kind of) a web application from a windows application.
A) The best way would be to publish web services or wcf services and consume them from the windows applications.
If you can''t add this feature, you can exchange data between the two applications in following ways:
B1) Automate a browser (Internet Explorer) via COM - you will have to code interfaces
B2) Use WebBrowser control - but you have to code browser functions
C) Use HttpClient class - there is noting visible, you have to simulate the browser actions and the logic of the client side code
D) Some other IPC - even more to code


单独的答案以避免混乱:

要从Windows应用程序打开ASP.NET网站,请执行以下操作:

1.如果网站已经托管在公共服务器上

Separate answer to avoid clutter:

To open a ASP.NET website from a windows application:

1. If the website is already hosted on a public server

ProcessStartInfo sInfo = new ProcessStartInfo("http://something.com/default.aspx");  
Process.Start(sInfo);



2.如果在同一台计算机上
- - 一个.在IIS的重要目录内配置网站(例如mysite)
---- b.做这个



2. If it is on the same machine
----a. configure the site inside a vitual directory in IIS ( say mysite )
----b. do this

ProcessStartInfo sInfo = new ProcessStartInfo("http://localhost/mysite/default.aspx");  
Process.Start(sInfo);


希望您能对此有所帮助.如果没有,请告诉我,我将尝试看看我能做什么.


I hope you will get things to work with this. if not do let me know and I will try to see what i can do.


这篇关于从C#打开一个asp.net项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆