如何使用vb .net,c#从html输入控件获取值 [英] How to get values from html input controls using vb .net ,c#

查看:77
本文介绍了如何使用vb .net,c#从html输入控件获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Quote:

如何使用vb.net,c#从邮件主题中获取html输入控件的值?#



i我收到邮件但我无法在主题中的html表单txt框中添加密钥

i我的文本框名称为

How to get values from html input controls in the subject of the mail using vb.net, c# ?

i am getting mail but i cant add the key in input from the html form txt box in the subject
i am having the text box name as

<input type="text" name="txt_name" size="30" id="txt_name" />





c #vb.net背后的脚本是:



c# vb.net behind script is:

<% @Page Language="C#" %>
<% @Import Namespace="System.Net.Mail" %>
<%
SmtpClient client = new SmtpClient("localhost");
MailAddress from = new MailAddress("test@my domain.com");

MailAddress to = new MailAddress("test@my domain.com");

MailMessage message = new MailMessage(from, to);
message.Body = "Testing";

message.BodyEncoding = System.Text.Encoding.ASCII;
message.Subject = "testing";
message.SubjectEncoding = System.Text.Encoding.ASCII;
client.Send(message);
Response.Write("Email sent");
%>

推荐答案

< u>在C#中

In C#
string strValue = Page.Request.Form["txt_name"].ToString();  



在VB中


In VB

Dim strValue As String = Page.Request.Form("txt_name").ToString()



这里 txt_name 是文本框的名称属性。


Here txt_name is name attribute of textbox.


这篇关于如何使用vb .net,c#从html输入控件获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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