Equivalient of ISSET in ASP (Classic ASP) - asp-classic

Ok Good afternoon.
I'm Just starting ASP.
in php i do something like this
<?php
If(isset($_POST["submit"]))
{
echo "You clicked me yeh?";
}
?>
Works without problems , Now i try to translate the same for ASP and i do something like this
<html>
<head>
<title>testHome in ASP</title>
<body>
<%
if Request.Form("submit") ="test" then
Response.Write("Ok Mate You Just Clicked Me!")
%>
<form name = "superform" id="superform" method="post" action="idc.asp">
<input type="submit" name="submit" value="test"/>
</form>
</body>
</head>
</html>
And instead i get this super annoying error.
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
Please What Seems to be the error here?

You need to close off the 'if ... then'
end if
If you can, you can get IIS to send error messages to the browser: IIS6 or IIS7
And if you are using visual studio you can also setup debugging

Related

Classic ASP Upload Throws Error

Good evening
I have been playing around with File upload i wanted to upload a File and have it send to the server and i Wanted to do this in plain Classic ASP
Saw some codes online and Played with it, Except it gave some Errors with IIS. Code looks like this
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadScript1.asp">
<INPUT TYPE="FILE" SIZE="40" NAME="FILE1"><BR>
<INPUT TYPE="FILE" SIZE="40" NAME="FILE2"><BR>
<INPUT TYPE="FILE" SIZE="40" NAME="FILE3"><BR>
<INPUT TYPE=SUBMIT VALUE="Upload!">
</FORM>
</BODY>
</HTML>
and the back end script looks like this
<HTML>
<BODY>
<%
Set Upload = Server.CreateObject("Persits.Upload")
Count = Upload.Save("c:\upload")
Response.Write Count & " file(s) uploaded to c:\upload"
%>
</BODY>
</HTML>
After enabling the debugger i got something that looks like this
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/uploadtest/UploadScript1.asp, line 4
800401f3
What could be Wrong?
The object Persits.Upload is a third-party component (a COM object) that has to be installed on the server. You can download a trial and/or purchase it here: http://www.aspupload.com/manual.html

Request.Form ASP not Working

This feels like a very stupid question, but I've been trying and searching for hours and can't figure out the problem. I'm new to pretty much all web development, and this was a test to figure out how to access form data on a new page. It just will not work for me. I have contactus.html and contactusaction.asp saved in the same folder on my desktop. Clicking submit loads contactusaction.asp, but "fname" will not appear on the next page no matter what I try. I've even copy and pasted other people's request.form examples, and I still have yet to get the comand to work in any way.
contactus.html:
<html>
<head>
Hello
</head>
<body>
<form method="post" action="contactusaction.asp"/>
<input type="text" name="fname"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
contactusaction.asp:
<html>
<head>Hello:</head>
<body>
<%
Dim x
x=Request.Form("fname")
Response.Write(x)
%>
</body>
</html>
Silly question, but after reading "saved in the same folder on my desktop" I have to ask - are you testing this using IIS or some other web server software on your desktop?
If you're just opening the local HTML page directly (double-clicking on the file vs running a local IIS and going to http://localhost/ or however you have it set up), there's no server running the actual ASP/VBScript code.
Also, reguardless of the answer to the above question, you should definitely fix the <form> tag as Guido Gautier mentions in his comment to your question.
This:
<form method="post" action="contactusaction.asp"/>
Should be this:
<form method="post" action="contactusaction.asp">

Form work on server, not locally. Ultimately need a programatic solution to submit the form

I need to submit this form (preferrebly using cURL):
<form method="post" action="results.asp" name=FrontPage_Form1 onSubmit="return true">
<input name="regno" size="7" maxlength=7>
<input type="submit" name="B1" size="15" value="Submit">
</form>
This form is on a website and works well there, redirects to page http:website//results.asp and shows the information.
BUT if I download this html form and open it in my local browser and submit, it does not work
the results.asp page says 'Access denied' in html page generated by the asp page.
Additional information:
- when the html page is on the same server: entering a wrong 'regno' results in a page which says exactly that
- Upon opening this form locally, it always says, access denied.
Please let me know if any of this is not clear.
If you open an html file into your local browser and then try to post to another page without the full URL, then it will look in the same directory for that file, which I imagine doesn't exist since you don't have access to it. You need to enter the full path in the form action, like so:
<form method="post" action="http://www.resultsserver.com/results.asp" name=FrontPage_Form1 onSubmit="return true">

ASP.NET ValidateRequest & XML in Standard HTML Forms

I have a very basic ASP.NET web site. It has a single page (TestPage.aspx) that I want to be able to launch using a POST request with some XML input. The basic HTML page that launches the request looks like this:
<html>
<head>
</head>
<body>
<form action="http://webserver/TestPage.aspx" name="Launch" method="post">
<input type="hidden" name="XMLmsg" value="<initialize>...</initialize>">
<input type="submit" value="Submit">
</form>
</body>
</html>
When the TestPage launches, however, I get the easily 'Google-able' "A potentially dangerous Request.Form value was detected from the client" error message.
It seems like the solution would be to put ValidateRequest="false" into my TestPage.aspx file, right? I thought so, too. And the internet told me the same thing. The only problem is...that didn't change anything. I still get the error.
I really need to be able to parse this XML. What can I do?
Well, I finally managed to get a solution to my problem, even if it's not perfect.
You can follow this link to a forum post where the whole process is tracked. The gist of it is that even added the necessary attributes didn't stop ASP.NET from validating requests from a standard HTML page, so I had to resort to writing a CGI app to accept the request and parse the inputs before sending back the necessary response.
For information on writing CGI for ASP.NET you can go here.
Is it optimal? No.
Is it clean? Not exactly.
Does it work? Yes.

a databind dropdow- list

<html>
<body>
<%# Language=VBScript ENABLESESSIONSTATE = False%>
<form Name="sushant" method="post" action="sushant.asp">
<select id="selFiles" name="selFiles" class="Select" style="width: 250px" tabindex="130">
<%
Dim fso, folder, files
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set folder=fso.GetFolder("C:\")
Set files=folder.Files
For each folderIdx In files
Response.Write("<option>" + folderIdx.Name + "</option>")
Next
%>
</select>
</body>
</html>
i am trying this code by giving its link in another file. but on execution IE shows an error in line set fso=Server.createobject..... i am trying but i could not locate the error. can anyone help me out. sorry for the formatting issue.
Generally, you'll get that error if the system cant find the registerd object. Give
regsvr32 %windir%\system32\scrrun.dll
a go, and see if it sorts you out.
I've also seen the problem,specifically with the FSO, on a server with AV software that seemed to block it, so check this out too.

Resources