IzzieBluPanda
IzzieBluPanda

Reputation: 11

ASP not running in .htm file in browser

I am attempting to run some asp code in a htm file however whenever I open the file it doesn't actually run the code but instead just displays the code without the '<%%>'. I've tried changing the file type to all sorts of things (.html, .asp, .aspx, .shtml) however none change anything and .asp doesn't even run (instead just displays the text as the the browser would when opening a text document).

I found some code on w3schools.com which is where I'm learning html however it doesn't work nor does the site mention any prerequisites for using asp code in an htm file. The code:

<!DOCTYPE html>
<html>
<body>
<% response.write(request.querystring("fname")) %>
</body>
</html>

I have gone and ticked the ASP Windows features and whatever else related but that did nothing. I am on a Windows 10, if that is relevant. I am using opera (though I've tried opening in Window's Edge as well) and just opening via double-click or dragging into window. I am new to html in general so sorry for such a dumb question that may have already been answered before, I have searched a lot but after quite some time I decided to just ask.

Upvotes: 0

Views: 565

Answers (1)

kooshy
kooshy

Reputation: 134

I'm not sure what you are learning, but I think you might have come across Classic Asp. I'd recommend you download Visual Studio Community Version which you can find here and instead try to learn ASP.NET. However, if you want to launch your file you will need to use the local IIS. Simply go to START and in the search bar type IIS: enter image description here

It should look like this:

On the left hand site, you will see SITES --> Right Click On it and point it to your Folder/File. Once it's there, then click on your SITE Folder in IIS and click on START which is on the right side with a red border. If it doesn't come up, click BROWSE *.443 which is right below it. It should launch.

If you are just starting, I'd suggest you download Visual Studio Code or ATOM and start creating simple .html files/website. It might be too overwhelming to go into ASP.NET or Classic before you become familiar with static .Html files.

Upvotes: 1

Related Questions