ASP not running in .htm file in browser - html

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.

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:
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.

Related

How can I add HTML code with notepad without installing an IDE

I am a starter in programming. One of my friends told me that I can start programing without installing any app and that I need only notepad to start learning HTML. The thing I can't find out is how I actually make it work. I inputted the code he gave me and I also made sure there where no typos, but then after I saved it I can not open it as a local file. I have only been able to open it as a text document so I can only see the code.
For this you have to save the file you are working on with the extension: .html. Then you have to open it with a browser, and you will see there the content of it
you can create a notepad and save it as name.html (not as .txt)
write the code inside it.
You can start with the notepad software. Unfortunately, this is not the best option. In fact, specialized software is recommended. Thanks to them, you will be able to write code faster thanks to the suggestions made by the software or to the very useful shortcuts! If you want to use this software, I recommend you one of the best on the market: Visual Studio Code.
If however you want to stay with notepad, you just have to click on "File" > "Save as" and to choose the type of file you want. In your case, it will be .html (Hypertext Markup Language)
You can create a file called [filename].html, and right click on it to open it in notepad. After Editing the file and adding your code to it, you can double click on it and it will open in your browser.
If you start enjoying to code, getting an IDE will make it much better. Visual Studio Code is recommended for this as it is user friendly and won't take up much storage space :)
code.visualstudio.com - Visual Studio Code
After saving the HTML code save it as filename.html, make sure that file extension is .html otherwise the filesystem will not recognized it.
Then right click on the file and open it with chrome or whatever browser you have and it will work, else open browser and drag it to browser and drop it, your html page will open in browser.

Application for editing and rending HTML side by side?

Is there an application that can edit and render and web page side-by-side similar to http://rendera.herokuapp.com/ , but can working "offline" (i.e. can be working even without internet connection).
I tried googling for WYSIWYG HTML editor, but I couldn't come with something similar to http://rendera.herokuapp.com/
I found Brackets (http://brackets.io/) somewhat similar to I'm looking for. I managed to find the similar question (different keywords) in StackOverflow (Is there an HTML/CSS/JS editor that immediately shows changes?), so somebody can mark this as duplicate
On windows just point your built-in IIS server to your working directory
When you edit your html , just refresh the web page
Use Python to serve up your web page from the directory your working in
python -m SimpleHTTPServer
When you edit your html, just refresh the web page
If using angularjs you can use
ng serve
This will load your website normally on localhost:4200 , any change to your code will force a reload of your website
Simply have your browser on one side and your editor on the other.

How to highlight section in VScode live server when clicking my source code?

Question
The editor brackets can do that. Supposed that, when I click my html tag in my source code file, the browser would automatically highlight the section/div in the broswer like google chrome developer tools.
Step 1
Click my tag in my source code file
Step 2
the live server will automatically focus on the section I want
How could I make it in VSCode?
VS Code does not have a built-in live server. Whatever extension you are using for live server can implement this, however I am not aware of any ones that do currently. Consider filing a feature request against them for this
Look at Five Server extension.
I used to love this Live Preview of Brackets, mainly for two unique features unlike many other editors and extensions:
It shows the preview live, literally. It doesn’t wait for file save to show the changes.
Highlights the section in the preview, corresponding to the html tag in which the cursor is placed currently.
I have been looking for a similar VS Code extension for a while.
Finally found it, JUST NOW.

Is there any way to open a local file from a html code in google chrome?

so, i've ben hunting for the answer, and seems like i can't get this to work, i wanted to make so that, i have a browser page already made in html, and when i click a link in there, it opens a chosen folder on the computer, but i don't want it to open on just this computer's path, I wanted to open a folder that is inside the main folder, so that anyone that has the same files as I do, can open it, i tried < a href="File_path">, tried putting < a href="file:///(file path)">, tried like i have in excel ../../'file path', and can't see where is the problem, anyone can help?
Here you need to use a "file" protocol to link a file in the HTML like,
Link
The browser may or may not open the file due to the security setting. You can click the right button and choose "copy link address" and then paste it into the browser.
There are security implications of showing a local file/folder from an website. It may work when the page is held locally but when on a server it will be failing. However definitely not any chosen folder anywhere in your PC.
If you require to achieve such you need custom implementation using a programming language like ASP .NET like shown in this example.
https://stackoverflow.com/a/6047826/684030
You haven't mention much details on what web server you are using. But if it's IIS (Windows) you may consider allowing directory browsing which may allow to show a sub directory under your website.

How can i go back, forward and print a (local) WebBrowser1.DocumentText html page that's sourced from my.resorces - vb.net

the title basically says it, i have a from with a treeview and a webbrowser control and three buttons. i want the back button to load the previous viewed html file from myresources and the same but opposite for forward?... also how can i and where can i link my external css to my program like my.resources so when i export the program for installing on another machine it still works? and one more thing... how can i intergrate/embed the webbrowser control into my program because as i believe it uses internet explorer and if someone installs my program onto their computer and they have un-installed ie and use firefox it won't work? thank you guys very much, i know it's a lot of questions but you guys are awesome!. thanks
It would be easy for you if you read this web pages from the resource file and then save them to a disk.
In this way you can simply pass the physical path to the Navigate method and similarly you can use GoBack and GoForward and Print methods.
But if you don't want them to save them, you still can read the web pages from the resource file and then use DocumentText property to display the webpage.
Using this method you won't be able to navigate back or forward.