问题
Currently, I have my html code have a form that inputs a first and last name. I have set the input type as submit and set the action attribute as the asp file. However, when I click the submit button, my brower shows me a dialog box and asks if I wanted to download the said asp file.
Here is the html code:
<!DOCTYPE html>
<html>
<body>
<form action="test1.asp" method="get">
First Name: <input type="text" name="firstname" /><br />
Last Name: <input type="text" name="lastname" /><br />
<input type="submit" value="Add Customer" />
</form>
</body>
</html>
I've researched on the submit form but my form code looks almost exactly like the code on this website: http://www.w3schools.com/html/html_forms.asp
I have also seen a question that is similar to the problem I am having:
ASP : File download of ASP page comes instead of executing it
However, in that scenario, the asp file is being executed itself, while I am trying to execute the asp file through a html form.
As always, any and all help is grealty appreciated.
回答1:
Classic ASP is not Installed by default on IIS 7.0 and IIS 7.5, see here and here to see how to enable it if this is the case for you.
Copied from these links:
In IIS 7.0 and 7.5, the classic version of ASP is not installed by default. Because of this, you might see HTTP 404 errors when you try to browse to an ASP page on your server, or you might see the source code for your ASP page displayed in your browser window. Both of these error conditions are created when configuration settings that are used to define the environment for classic ASP are not installed.
Hope this helps.
来源:https://stackoverflow.com/questions/11159358/unable-to-run-asp-file-instead-being-prompted-to-download-said-asp-file