I am learning to code .asp and am trying to set up a local environment for me to test simple asp codes.
I have just installed IIS on my PC running windows 10.
My browser successfully loads "localhost"
I have pasted the following code with the filename of test.html into the inetpub/wwwroot ,
<!DOCTYPE html>
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>
Navigating to localhost/test.html works fine.
Now, I want to change the file extension from test.html to test.asp. After i had done this, my browser is not able to load localhost/test.asp at all. It shows the following error,
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I am expecting the webpage to display "Hello World!"
ASP is legacy ASP.NET. I believe what you want is to use ASP.NET therefore name your file:
test.aspx
I don't think you want to try technology from 18 years ago but if that were your case, you will need to activate this feature Windows 10. In order to do this you will have to go to Windows Components and features and enable this old feature here:
Related
I've previously explained that I was trying to link a ejs page to a jade-based app. Then after many failed attempts I tried to convert that page to Jade and still ended up with a truckload of errors. Finally, I thought about simply putting a HTML Link that would redirect me to that ejs page on click.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser:
file:///home/ghanem/Documents/Project/views/account/el/el.ejs
But when I try to access it from my app through a simple code, it doesn't redirect me to the same very page:
My Stubborn Link
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser
Because it trusts you
But when I try to access it from my app through a simple code
Your app is "just another website" as far as Firefox is concerned. It doesn't trust it.
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
That lets XMLHttpRequest access file:// URLs providing the document it is running in was loaded from a file:// URL.
See mozillaZine: Links to local pages do not work.
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://localhost:7896");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
I have a webapp built with angular/grunt/yeoman.
This is the problem that I have:
File home.html:
<h1>hello</h1>
I grunt build, then check the page in my brower. Everything is fine.
Then I change
home.html to
<h1>hello 2</h1>
I grunt build, then in my browser I still see hello if I navigate to this page by clicking links. If I refresh the page with the browser button, I see hello 2.
Why is that ? How to tell grunt to build the app so the browser re-fetches every html page ?
Note: I have no problem with html/css since they are concatenated into a single file, and the file name changes every build.
I am using chrome.
You could:
Use a plugin to clear the browser cache, for example: Clear Cache
Use a web server that explicitly forbids caching
I'm trying to load the native messaging example app in an external webpage as follows:
test.html
<html>
<head>
</head>
<body>
<iframe src="chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/main.html"</iframe>
</body>
</html>
I have added the web_accessible_resources property in the app's manifest:
manifest.json
{
// <some code snipped>
"web_accessible_resources": ["main.html"]
}
However, when I use the app within test.html, I get the following error in the console, coming from a JavaScript file within the app:
Developer Console
Uncaught TypeError: Object # has no method 'connectNative'
main.js:51
The problematic line of code is the following:
main.js
port = chrome.runtime.connectNative(hostName);
Here's a screenshot - the problem happens when I click on the Connect button (which calls the connect function):
Obviously, this works when the app is run standalone. How can I go about loading the app in a webpage?
You can't. With very few exceptions, Chrome avoids proprietary extensions to the open web. You're asking for exactly that: an external web page that has nonstandard abilities simply because it's opened in Chrome rather than another browser. As the web is today, that kind of behavior would lead to a poor developer and user experience. The native-messaging documentation suggests that the functionality you want is available to Chrome extensions and Chrome apps. And as you're finding out, that's indeed the case: it works as an app, but not as a web-standard iframe. This is by design.
You probably want to write a Chrome extension. Your webpage should detect whether the Chrome extension is installed and whether the user's browser is Chrome. If it's not Chrome, it should give an appropriate error message. If it is Chrome but the extension is not installed, it should urge the user to install your extension.
I tried to execute the following set of coding which is already in w3schools
index.html has the following codings
<!DOCTYPE html>
<html manifest="demo_html.appcache">
<body>
<script src="demo_time.js"></script>
<p id="timePara"><button onclick="getDateTime()">Get Date and Time</button></p>
<p><img src="logo.jpeg" width="336" height="69"></p>
<p>Try opening this page, then go offline, and reload the page. The script and the image should still work.</p>
</body>
</html>
demo_time.js contains the following
function getDateTime()
{
var d=new Date();
document.getElementById('timePara').innerHTML=d;
}
demo_html.appcache contains the following
CACHE MANIFEST
CACHE:
/index.html
/demo_time.js
/logo.jpeg
".htaccess" file contains the following
AddType text/cache-manifest .appcache
Please point out the mistake in this code. When i executed the code in my browser, firefox prompted me to This website is asking to store data on your computer for offline use. Allow, never for this site or not now. I choose Allow, but the prompt did not disappear even then.
When i tried the same in w3schools.com, the prompt disappeared after i clicked Allow. Please point out the mistake in the above code
Offline cache only works for remote files. When you run the page locally, it won't actually offline the files.
If you access your page via a server, you should see the offline cache working.
I changed the demo_html.appcache to the simpler
CACHE MANIFEST
index.html
demo_time.js
logo.jpeg
and that works for me in both firefox and chrome
Chromes "Resources" tab is really helpful for debugging the appcache:
Hi I have crawled a website for offline view, but many pages are downloaded and saved as .asp and there are links that point to these pages. But when I open these html page that has .asp extension in Chrome browser, the chrome will download the page instead of rendering the page. Is there a way to set the chrome to render the page instead of downloading it ?
Thanks
Chromium uses the system mime-type for the local files. On Linux you can change it in the xdg-open configuration:
$ mkdir -p ~/.local/share/mime/packages
$ cd ~/.local/share/mime/packages
$ touch application-x-asp.xml
Then edit the ~/.local/share/mime/packages/application-x-asp.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="text/html">
<comment>Active Server Page</comment>
<icon name="text-html"/>
<glob-deleteall/>
<glob pattern="*.asp"/>
</mime-type>
</mime-info>
to set up the mime-type to text/html. On te end you have to logout/-in again, or just run:
$ update-desktop-database ~/.local/share/applications
$ update-mime-database ~/.local/share/mime
When your browser opens a file it uses the MIME type to decide which action it should take, typically download or open in the bowser.
So, for example, it encounters a zip file it will open the file save dialogue box and allow you to save the file.
And, if for example, you request a .asp from your browser which is served from a web server the browser will use the MIME type to decide which action to take, which will be to display in the browser.
The MIME type will be sent within the http headers and this would not be sent to the browser when you open your off-line .asp pages.
So if you could change the MIME type to "text/html" for .asp it should open it in the browser.
Unfortunately, there does not seem to be an option for changing MIME type / actions in Chrome.
You can change these setting in Firefox within Tools > Options > Content > FileTypes > Manage..
There is a way to open local, .asp files as HTML in Firefox.
Find your Firefox profile folder. On Windows 7, I found it here:
C:\Users\user\AppData\Roaming\Mozilla\Firefox\Profiles\738xdie.default\mimeTypes.rdf
Then add these lines to mimeTypes.rdf
<RDF:Description RDF:about="urn:mimetype:text/html"
NC:fileExtensions="asp"
NC:description="ASP Pages"
NC:value="text/html"
NC:editable="true">
</RDF:Description>
Restart browser. Your local file will now render as HTML.
There may be a similar technique with Chrome.
I suppose you want to view downloaded pages directly, that is not via some local web-server. Then I'd suggest to change (or append) file extensions during download according to their reported content-types from response headers. Of course, this will require to adjust all links to changed filenames inside other files. The other approach could be to store content-type of each page in a meta-base, and using a local web-server to serve the files according to their actual types from the base, not file extensions.
I have two solutions for you. the first one is to open those files with firefox.. and that's it..
if you insist to open them with chrome. you have to change all files extension to html instead of asp. use some programs for renaming..
but the links will be broken between pages..
so you have to find the js file that all pages use add this code in it to fix the links
document.body.addEventListener('click',function(e){
if(e.target.nodeName=='A'){
e.preventDefault()
href=e.target.href.split('/')
href[href.length-1]=href[href.length-1].replace('.asp','.html')
href=href.join('/')
parent.location=href
}
})
})