Request.Form ASP not Working - asp-classic

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">

Related

Equivalient of ISSET in ASP (Classic ASP)

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

Why my input with ng-model doesn't bind data to other element?

I have ASP.NET MVC5 application.
I included script like this:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
And I also did:
<input ng-model="someTest" type="text" />
<h1>Hello {{someTest}}</h1>
But when I write something into input, my <h1> doesnt update!
Console is clear, no errors, script is loaded correctly.
All I see on website is EXACTLY:
Hello {{someTest}}
What is wrong?
Even when I download script and include directly to project, problem is the same.
You likely need the ng-app tag, unless you have it somewhere that you aren't showing:
<div ng-app>
<input ng-model="someTest" type="text" />
<h1>Hello {{someTest}}</h1>
</div>

IFrame in content script. How to communicate with main.js?

My Firefox add-on opens Fancybox (type: "iframe") from a content script (page-mod). In the Fancybox I show my own HTML page (my_fancybox_stuff.html) that is located in my own server.
Now, from the my_fancybox_stuff.js (javascript of my_fancybox_stuff.html), can I send a message to the add-on's main.js? Or to the content script that opened the Fancybox?
I was hoping the global 'self' object to be accessible from my_fancybox_stuff.js as it is accessible from the content script that opened the Fancybox.
I am interested to hear about any potential workarounds to get this done.
In Chrome extension this is trivial. In my_fancybox_stuff.js I can call chrome.extension.sendMessage() and it works.
Thanks in advance!
EDIT: Adding some code to clarify my case. Simplified the code to save folks' time on reading it. This is simple as hello world.
From the contents_scipt.js (injected with page-mod) I call:
$.fancybox.open(
{
// Some irrelevant Fancybox options hidden for clarity
href:"http://www.mysite.com/my_fancybox_stuff.html
type: 'iframe'
}
);
my_fancybox_stuff.html would look something like this:
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery.js"></script>
<script src="js/my_fancybox_stuff.js"></script>
</head>
<body>
<div id="my-wrapper">
<div id="my-form-div">
<form id="my-form" action="#">
<div>
<div><p>Name</p></div>
<div><input id="fullname" type="text" name="fullname" value=""></div>
</div>
<div>
<div><p><a id="my-button" href="#">Press this</a></p></div>
</div>
</form>
</div>
</div>
</body>
In my_fancybox_stuff.js, when button ("my_button") is pressed, I want to send out a message containing the value of the input field ("fullname") and listen it in content_script.js.
Yes, your my_fancybox_stuff.js can communicate with your add-on's content script using postMessage ().
See the documentation and examples at MDN.

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