页面加载时在ASP .NET中调用C#代码 [英] Call C# code in ASP .NET when page loads

查看:82
本文介绍了页面加载时在ASP .NET中调用C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,

我是ASP .NET技术的新手(但是对其他诸如C#的.NET技术非常了解).我想知道在给定HTTP请求中的所有相关数据(将POST信息传递给它)的情况下,是否可以(以及如何)仅在页面加载时执行C#代码.并只需将返回的字符串写回到HTTP响应中即可.

非常感谢您的帮助.

Hey,

I''m new to the ASP .NET technology (but much acquainted to other .NET technologies like C#). I would like to know whether (and how) is it possible to execute C# code simply when the page loads, given all the relevant data from the HTTP request (pass POST information to it). and simply write the returned string back in the HTTP response.

Thanks a lot for helping.

推荐答案


简单方法:在Page_Load事件(与ASP.NET服务器端相关)中,使用!IsPostBack 属性指示第一页加载.

在此处阅读有关此主题的更多信息: http://stackoverflow.com/questions/5364375/page- load-vs-onload [ ^ ]

问候,
AB
Hi,
The simple approach: in Page_Load event (pertinent to ASP.NET server side) use !IsPostBack property that indicates the first page load.

Read more on this topic here: http://stackoverflow.com/questions/5364375/page-load-vs-onload[^]

Regards,
AB


这篇关于页面加载时在ASP .NET中调用C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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