How to get variables that server POSTs using ASP

 
Post new topic   Reply to topic    Aprelium Forum Index -> Classic ASP
View previous topic :: View next topic  
Author Message
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Thu Jul 05, 2007 8:17 am    Post subject: How to get variables that server POSTs using ASP Reply with quote

Hi!

I know almost nothing about ASP that's why I would like to ask how to obtain server variables like
path
virtual_path
filename

and so on using ASP code for making script reflecting particular directory content?

I have tryed to use Request.ServerVariables ("path") but I didn't get current location, I got error message...

Thank all in advance!
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jul 05, 2007 3:55 pm    Post subject: Re: How to get variables that server POSTs using ASP Reply with quote

alexey.spb,

These variables have standard and official names: check the list in http://www.aprelium.com/data/doc/2/abyssws-win-doc-html/cgivars.html .

For example, to get the current virtual path, you'll have to use:

Code:
Request.ServerVariables ("SCRIPT_NAME")

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Thu Jul 05, 2007 5:14 pm    Post subject: Reply with quote

Thanx a lot!
Sorry for this stupid question!

Resolved.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jul 07, 2007 3:07 pm    Post subject: Reply with quote

alexey.spb,

You're welcome.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Wed Jul 11, 2007 6:33 pm    Post subject: Reply with quote

OK.
I would like create script as template for directory listing using ASP.

I'm doing this:

<BODY onLoad="msg()">
<form method="post" action="test.asp">
<input type=hidden name="FILE_FOLDER" value=path>
</form>

Goal of this is to get path variable that server POSTs.

And after that I'm trying to check value:

<div align="center"> <p class=TabHeader><%=FILE_FOLDER%></p><br><br></div>

Result is empty string. I misunerstood something definitely...
What I did wrong?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Jul 12, 2007 10:25 pm    Post subject: Reply with quote

alexey.spb wrote:
<div align="center"> <p class=TabHeader><%=FILE_FOLDER%></p><br><br></div>

Result is empty string. I misunerstood something definitely...
What I did wrong?


To get the variable FILE_FOLDER passed in the form, you should use
Code:
Request.Form("FILE_FOLDER")
instead of
Code:
FILE_FOLDER

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Fri Jul 13, 2007 9:15 am    Post subject: Reply with quote

Sorry for annoying, but I'm still in trouble...
Let's change:
<%
Function StripFileName(strFile)
StripFileName = Left(strFile, inStrRev(strFile, "\"))
End Function
%>
<BODY>
<form method="post" action="test.asp">
<input type=hidden name="TEMP" value=path>
<%
FILE_FOLDER = StripFileName(Request.Form("TEMP"))
%>
</form>

I'm expecting to get string with current path (FILE_FOLDER) but I'm getting nothing...

Also:
Dim oFS, oFolder, oFile
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
Set oFolder = oFS.getFolder(FILE_FOLDER) 'error: illegal argument!
Set objFolders = oFolder.SubFolders
Set objFiles = oFolder.Files
[/b]
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jul 14, 2007 2:38 pm    Post subject: Reply with quote

alexey.spb wrote:
Set oFolder = oFS.getFolder(FILE_FOLDER) 'error: illegal argument!


It seems that the value of FILE_FOLDER is not accepted by oFS.getFolder. This is a programming problem here and you'll probably have to debug your script to understand what FILE_FOLDER contains and why is that value not good for oFS.getFolder.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
alexey.spb
-


Joined: 02 Jul 2007
Posts: 17
Location: STP, Russia

PostPosted: Fri Dec 28, 2007 1:23 pm    Post subject: Variables that server POSTs to script... Reply with quote

I would like to make one notice regarding things that was written in manual:
Quote:

name1→ url1→ size1→ date1→ MIME-type1[CR]
[CR] represents the carriage return character (ASCII code 13 - \n)

This definition contains mistake - you can check it using InStr(chr13)) - it will be equal 0.
The same result gives InStr(vbCr). But server places LF symbol as end of the line.
This is minor bug but it is desirable that it should be fixed in manual :-)
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jan 02, 2008 5:03 pm    Post subject: Re: Variables that server POSTs to script... Reply with quote

alexey.spb,

Thank you for pointing that out. On Windows, the lines are terminated by CR+LF whereas on other systems they are terminated by CR only. This is in accordance with each operating system end of line convention.

The documentation will be updated to reflect that.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Classic ASP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group