从C#脚本转换为在Asp.Net中使用 [英] Translate from C# script to use in Asp.Net

查看:70
本文介绍了从C#脚本转换为在Asp.Net中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在C#应用中使用了这段代码,需要
现在在Asp.Net中使用它,但不知道如何编码
在Asp.Net中.这是代码:

Hi,

I used this piece of code in an app in C# and need to
use it now in Asp.Net, but don''t know how to code it
in Asp.Net. Here is the code:

if (lblStatus.InvokeRequired)
                lblStatus.Invoke(new MethodInvoker(delegate { lblStatus.Text = temp.DataBlock.ToString(); }));



请帮我解决这个问题!



Please help me with this!!

推荐答案

简短答案:您不能.

严格来说,由于您没有在代码示例中显示完全限定的名称,所以我的意思是我的猜测,但这不太可能发生.它看起来像UI代码,最有可能使用System.Windows.Forms.如果与ASP.NET无关.即使您可以在ASP.NET应用程序中正式编写它,应用程序主机如何运行它?在服务器端?谁会看到它? :-)

问题不在于您不知道ASP.NET是如何工作的.您似乎不知道Web应用程序的工作方式,否则您将不会提出这样的问题.

您只能做一件事:完全重新编写并重写ASP.NET中的所有UI.您感兴趣吗?从此处开始: http://www.asp.net/get-started [
Short answer: you cannot.

Strictly speaking, as you did not show fully qualified names in your code sample, so what I say is my guess, but this is unlikely something else. It looks like UI code, most likely using System.Windows.Forms. If has nothing to do with ASP.NET. Even though your could formally write it in the ASP.NET application, how the application host can run it? On the server side? Who will see it? :-)

The problem is not that you don''t know how ASP.NET works. It looks like you have no idea how a Web application works, otherwise you would not ask such question.

You can do only one thing: totally redesing and rewrite all your UI in ASP.NET. Are you interested? Start from here: http://www.asp.net/get-started[^].

—SA


这篇关于从C#脚本转换为在Asp.Net中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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