为什么是“%2E”出现而不是点? [英] why is "%2E" showing up instead of the dot?

查看:188
本文介绍了为什么是“%2E”出现而不是点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP页面正在做一些奇怪的事情,我认为它与

有关,%2E替换了文件名中的点但是另外,如果我右键单击

链接并选择另存为,文件扩展名重复为

" Week20.pdf.pdf"

这里是相关信息:


<%

set directory = server.createobject(" scripting.filesyste mobject")

set allfiles = directory。 getfolder(server.mappath(" / MMM / Lesson /"))

''列出目录中找到的所有文件

对于allFiles.files中的每个目录文件

%>

< a href = MMM / Lesson /<%

''写出文件名称

response.write server.urlencode(directoryfile.name)%>><%

response.write directoryfile.name%>

< / a>


这就是它在已发布页面的来源中显示的结果


< a href = MMM / Lesson /

Week20%2Epdf> Week20.pdf

< / a>


%E2这是我以前从未注意过的事情。

代码是否合适?

重复的扩展名怎么样?

My ASP page is doing something wierd, I think it has something to do with
the %2E replacing the dot in the file name But in addition, if I right click
the link and select "save as", the file extension is duplicated as
"Week20.pdf.pdf"
here is the relevant info:

<%
set directory=server.createobject("scripting.filesyste mobject")
set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
'' Lists all the files found in the directory
For each directoryfile in allFiles.files
%>
<a href=MMM/Lesson/ <%
'' Write out the name of the document
response.write server.urlencode(directoryfile.name) %>><%
response.write directoryfile.name %>
</a>

This is how it turns up in the source of the published page"

<a href=MMM/Lesson/
Week20%2Epdf>Week20.pdf
</a>

The "%E2" is something I never noticed before.
does the code look right?
what about the duplicated extensions?

推荐答案

%2E是因为


server.urlencode(directoryfile.name)


方法。在大多数情况下,这种方法不是必需的。对于QueryString技术,它通常只使用

,但如果你的所有文件名都是字母,

数字和句号,那就不用费心了。我不确定,但是

,因为文件名在代码中没有扩展名,这可能会欺骗

浏览器再次添加它。在第二次添加它之后,它会将%2E解释为选择另存为的时间段。所以我的

建议是摆脱server.urlencode()方法,以便你的生成代码看起来像你想要的那样,然后看看这是否修复了另一个

部分。

-

Nathan Sokalski
nj ******** @ hotmail.com
http://www.nathansokalski.com/


新闻:ez ************** @ TK2MSFTNGP10.phx.gbl ...
The %2E is there because of the

server.urlencode(directoryfile.name)

method. In most cases, this method is not necessary. It is usually only used
for QueryString techniques, but if all your filenames have is letters,
numbers, and the period, don''t bother with it. I don''t know for sure, but
because the filename has no extension in the code, this may be tricking the
browser into adding it a second time. After it adds it the second time, it
then interprets the %2E as a period when you select "save as". So my
suggestion is get rid of the server.urlencode() method so that your
generated code looks the way you want, and then see if this fixes the other
part.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
我的ASP页面正在做一些奇怪的东西,我认为它与%2E替换文件名中的点有关。但另外,如果我正确点击链接并选择另存为,文件扩展名被复制为
Week20.pdf.pdf
这里是相关信息:

<%
set directory = server.createobject(" scripting .filesyste mobject")
设置allfiles = directory.getfolder(server.mappath(" / MMM / Lesson /"))
''列出目录中找到的所有文件
allFiles.files中的每个目录文件
%>
< a href = MMM / Lesson /<%
''写出文件的名称
response.write服务器.urlencode(directoryfile.name)%>><%
response.write directoryfile.name%>
< / a>

这就是它在已发布页面的来源中的显示方式

< a href = MMM / Lesson /
Week20%2Epdf> Week20.pdf
< / a> ;

%E2这是我以前从未注意过的事情。
代码是否正确?
重复的扩展名怎么样?
My ASP page is doing something wierd, I think it has something to do with
the %2E replacing the dot in the file name But in addition, if I right
click the link and select "save as", the file extension is duplicated as
"Week20.pdf.pdf"
here is the relevant info:

<%
set directory=server.createobject("scripting.filesyste mobject")
set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
'' Lists all the files found in the directory
For each directoryfile in allFiles.files
%>
<a href=MMM/Lesson/ <%
'' Write out the name of the document
response.write server.urlencode(directoryfile.name) %>><%
response.write directoryfile.name %>
</a>

This is how it turns up in the source of the published page"

<a href=MMM/Lesson/
Week20%2Epdf>Week20.pdf
</a>

The "%E2" is something I never noticed before.
does the code look right?
what about the duplicated extensions?



":MMAC:" <丢失@海>在消息中写道

新闻:ez ************** @ TK2MSFTNGP10.phx.gbl ...

:我的ASP页面是做一些奇怪的事情,我认为它与

有关:%2E替换文件名中的点但是另外,如果我正确

点击

:链接并选择另存为,文件扩展名重复为

:" Week20.pdf.pdf"

:这里是相关信息:



:<%

:set directory = server.createobject(" scripting.filesyste mobject")

:设置allfiles = directory.getfolder(server.mappath(" / MMM / Lesson /"))

:''列出目录中找到的所有文件

:对于allFiles.files中的每个目录文件

:%>

:< a href = MMM / Lesson /<%

:''写出文件的名称

:response.write server.urlencode(directoryfile.name) %>><%

:response.write directoryfile.name%>

:< / a>



:这就是它在已发布页面的来源中的显示方式



:< a href = MMM / Lesson / < br $>
:Week20%2Epdf> Week20.pdf

:< / a>



:" %E2"这是我以前从未注意过的事情。

:代码看起来是否正确?

:重复的扩展名怎么样?


为什么你编码吗?


-

Roland Hall

/ *这些信息的分发是希望它会是有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp
".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
: My ASP page is doing something wierd, I think it has something to do with
: the %2E replacing the dot in the file name But in addition, if I right
click
: the link and select "save as", the file extension is duplicated as
: "Week20.pdf.pdf"
: here is the relevant info:
:
: <%
: set directory=server.createobject("scripting.filesyste mobject")
: set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
: '' Lists all the files found in the directory
: For each directoryfile in allFiles.files
: %>
: <a href=MMM/Lesson/ <%
: '' Write out the name of the document
: response.write server.urlencode(directoryfile.name) %>><%
: response.write directoryfile.name %>
: </a>
:
: This is how it turns up in the source of the published page"
:
: <a href=MMM/Lesson/
: Week20%2Epdf>Week20.pdf
: </a>
:
: The "%E2" is something I never noticed before.
: does the code look right?
: what about the duplicated extensions?

Why are you encoding it?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


Nathan,Roland,


为什么的简短回答是因为我不知道更好。

这是我前一段时间从这个论坛得到的一个示例脚本,它做了我需要它做的事情b $ b将目录中的所有文件列为可点击

链接。

我很高兴让它工作我从未质疑它。

什么会是一个更好的方式吗?

" Roland Hall" <没有人@无处>在消息中写道

news:Op ************** @ TK2MSFTNGP09.phx.gbl ...
Nathan, Roland,

The short answer to "why" is because I don''t know any better.
This was an example script I got from this forum a while ago that did what I
needed it to do which was to list all the files in a directory as clickable
links.
I was so excited to have it work I never questioned it.
What would be a better way?
"Roland Hall" <nobody@nowhere> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
"。:mmac :"。 <丢失@海>在消息中写道
新闻:ez ************** @ TK2MSFTNGP10.phx.gbl ...
:我的ASP页面正在做一些奇怪的事情,我认为它有要做什么

:%2E替换文件名中的点但是另外,如果我正确点击
:链接并选择另存为,文件扩展名重复为
:" Week20.pdf.pdf"
:这里是相关信息:

:<%
:设置目录= server.createobject(" scripting.filesyste mobject")
:set allfiles = directory.getfolder(server.mappath(" / MMM / Lesson /"))
:''列出所有目录中找到的文件
:对于allFiles.files中的每个目录文件
:%>
:< a href = MMM / Lesson /<%
:''写out of the document of name
:response.write server.urlencode(directoryfile.name)%>><%
:response.write directoryfile.name%>
:< ; / A&克t;

:这就是它在已发布页面的来源中的显示方式

:< a href = MMM / Lesson /
: Week20%2Epdf> Week20.pdf
:< / a>

:"%E2"这是我以前从未注意过的事情。
:代码看起来是否正确?
:重复的扩展名怎么样?

为什么编码它?
-
Roland Hall
/ *这些信息的分发是希望它有用,但
没有任何保证;甚至没有适销性的暗示保证
或适合特定用途的适用性。 * /
Technet脚本中心 - http://www.microsoft.com / technet / scriptcenter /
WSH 5.6文档 -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
: My ASP page is doing something wierd, I think it has something to do
with
: the %2E replacing the dot in the file name But in addition, if I right
click
: the link and select "save as", the file extension is duplicated as
: "Week20.pdf.pdf"
: here is the relevant info:
:
: <%
: set directory=server.createobject("scripting.filesyste mobject")
: set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
: '' Lists all the files found in the directory
: For each directoryfile in allFiles.files
: %>
: <a href=MMM/Lesson/ <%
: '' Write out the name of the document
: response.write server.urlencode(directoryfile.name) %>><%
: response.write directoryfile.name %>
: </a>
:
: This is how it turns up in the source of the published page"
:
: <a href=MMM/Lesson/
: Week20%2Epdf>Week20.pdf
: </a>
:
: The "%E2" is something I never noticed before.
: does the code look right?
: what about the duplicated extensions?

Why are you encoding it?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp



这篇关于为什么是“%2E”出现而不是点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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