Home > OS >  How to save webpage as it's extension
How to save webpage as it's extension

Time:02-20

I want to save a webpage as it's specific extension. If I try to do Ctrl S, there are only two options. HTML, and Mime HTML. But say the page is http://example.net/foo/bar.aspx. I would like to save the page specifically as an .aspx file. I also try viewing the source code, but just get more HTML. How can I download the site/file as it's exact file extension, not just the HTML version?

Thanks in advance

CodePudding user response:

I don't think the World Wide Web works the way you think it does. A URL like http://example.net/foo/bar.aspx is not necessarily a bar.aspx files stored at path ~/foo on server example.net, although it could be.

URLs are requests to web servers; the server figures out how to satisfy that request, and sends the response. In your particular case, the server thought an HTML file would satisfy the request.

.aspx is a common file extension for Microsoft ASP.NET programs. When such a program runs, it can send any kind of response it wants. In your example it sends some HTML; that is why your web browser offers to store it as .html.

ASP.NET programs typically do not send their .aspx source code as responses, although I suppose that would be possible. Think of downloading a game via Steam or something; when you do that is sends the compiled game application, not the source code. ASP.NET typically works the same way.

Even if the example.com site sent the source code, you probably wouldn't be able to run it because it would probably require things like database connections or binary resources.

Instead of trying to download source code from web sites, explain what you are trying to do. Are you trying to learn how to write an ASP.NET program?

  • Related