从 ASP.NET 中的 POST 方法检索数据 [英] Retrieving data from a POST method in ASP.NET

查看:15
本文介绍了从 ASP.NET 中的 POST 方法检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 ASP.NET.

I am using ASP.NET.

有一个系统需要将数据发布到我的网站,他们要求我向他们提供一个 URL.所以我给了他们我的 URL http://www.example.com/Test.aspx.

There is a system that needs to POST data to my site and all they asked for is for me to provide them with a URL. So I gave them my URL http://www.example.com/Test.aspx.

现在我不知道他们是如何发布它的,但现在在我的 Test.aspx 页面上,我需要编写将数据保存到数据库的代码.

Now I do not know exactly how they POST it but now on my Test.aspx page I need to write code that will save that data to a database.

但是这将如何工作以及我必须在我的 Test.aspx 页面上做什么?

But how would this work and what must I do on my Test.aspx page?

我在我的页面加载事件中编写了一些代码,这些代码会向我发送有关页面加载的电子邮件,以查看它们是否真的点击了页面,并且看起来它们似乎不是均匀的?

I wrote some code in my Page Load Event that sends me an email on Page Load to see if they actually hit the page and it does not seem like they are even?

推荐答案

您可以使用与此类似的代码 (C#) 获取发布到页面的表单值 -

You can get a form value posted to a page using code similiar to this (C#) -

string formValue;
if (!string.IsNullOrEmpty(Request.Form["txtFormValue"]))
{
  formValue= Request.Form["txtFormValue"];
}

或者这个(VB)

Dim formValue As String
If Not String.IsNullOrEmpty(Request.Form("txtFormValue")) Then
    formValue = Request.Form("txtFormValue")
End If

获得所需的值后,您可以构建 SQL 语句并将数据写入数据库.

Once you have the values you need you can then construct a SQL statement and and write the data to a database.

这篇关于从 ASP.NET 中的 POST 方法检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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