ASP:的request.form没有返回值? [英] ASP: request.form is not returning value?

查看:251
本文介绍了ASP:的request.form没有返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下形式

<form action="contact_us.asp" method="post" enctype="multipart/form-data" name="form1" id="form1">
   <input name="firstname" type="text" id="firstname" size="30" />
   <input name="lastname" type="text" id="lastname" size="30" />
   <input type="submit" name="submit" id="submit" value="Submit" />
</form>

但是,当我试图让我的ASP文件contact_us.asp这些后变量的值,那么它将返回空白。 code是如下:

But when I am trying to get value of these post variables in my ASP file contact_us.asp then it returns blank. Code is below:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<%

Dim FirstName, LastName, Email, Message
FirstName = request.form("firstname")
LastName = request.form("lastname")

response.write(FirstName & "OK")

%>

它仅返回OK给我。没有什么消息变量?

Its returning only "OK" to me. nothing in Message variable?

请帮帮我,告诉我什么是错在这里?

Please help me and tell me what's wrong here?

推荐答案

经典ASP不支持的multipart / form-data的。这甚至对ASP的高龄的语言令人惊讶的基本缺陷,但你打算怎么办呢,移动到ASP.NET? (是的哦。还有从来没有那么介意。)

Classic ASP doesn't support multipart/form-data. This is a surprisingly basic deficiency even for a language of ASP's venerable age, but what're you gonna do about it, move to ASP.NET? (Yes? oh. well never mind then.)

如果你没有做文件上传,这是最简单的只是坚持使用默认的是enctype (这是应用程序/ x-WWW的形式-urlen codeD )。 的multipart / form-data的的唯一好处是,你可以把文件上传它。 (理论上,它也将有一个可以明确指定字符编码的优势。但是,没有浏览器实际上是这样做的。)

If you aren't doing file uploads, it's easiest just to stick with the default enctype (which is application/x-www-form-urlencoded). The only advantage of multipart/form-data is that you can put file uploads in it. (Theoretically, it would also have the advantage that you can specify character encodings definitively. But no browser actually does that.)

如果你需要处理的multipart / form-data的经典ASP,你需要自己分析传入的请求体,它分裂成字段和值。或者说,更典型,使用现有的库做*。

If you do need to handle multipart/form-data in Classic ASP you will need to parse the incoming request body yourself, splitting it into fields and values. Or rather, more typically, use an existing library to do it*.

这是库通常会读取上传的文件和其他形式的值提供了独立的接口。这完全取代使用传统的ASP 的Request.Form 接口。正是你可以找到它取决于您选择的库。这是否意味着,如果你想有一个可以为是enctype 同样你必须检查的种类和使用两种不同的接口之一。

That library will usually provide separate interfaces for reading the uploaded files and the other form values. This completely replaces use of the Classic ASP Request.Form interface. Exactly where you can find it depends on the library you choose. This does mean that if you want to have a form that can respond to either enctype equally you have to check the type and use one of the two different interfaces.

*:有负载。 < A HREF =htt​​p://www.freeaspupload.net/>例如。我不认可其中任一如此......他们都没有真正正确地解析multipart内容按照标准和双方似乎有点松懈名安全(的从不的存储下提交的用户文件文件名!安全灾难!)。但是,这似乎是意料之中的事了ASP上载脚本。至少,不像许多,他们不问钱他们。

*: There are loads. for example. I'm not endorsing either of these as such... neither of them actually parse multiparts properly as per the standard and both seem a bit lax about filename security (never store a file under the user-submitted filename! security disaster!). But that seems to be par for the course for ASP upload scripts. At least, unlike many, they're not asking money for them.

这篇关于ASP:的request.form没有返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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