Search code examples
htmlasp.netdownloadasp.net-webpages

Why is download button disabled after aspx page is downloaded as a file on my machine?


I have downloaded an aspx page with a .file extension using python. The said file opens up in the web browser however the download button is disabled. This is the URL from where I have downloaded the aspx page on my local machine: https://www.rad.cvm.gov.br/ENETCONSULTA/frmGerenciaPaginaFRE.aspx?NumeroSequencialDocumento=111672&CodigoTipoInstituicao=2

This is just one instance and I have multiple such instances.

When I open the file on my local using a web browser, the file opens however I get a message stating that

File not found Check the file name for capitalization or other typing errors.
Check to see if the file was moved, renamed or deleted as well as the download button is disabled.

What could be the cause of this? Please help. Thanks!


Solution

  • Well, it is a HUGE, LARGE, VAST, Mount Everest of a difference to pull some existing aspx page from a existing site.

    that web page will be of NEAR ZERO use!!!

    aspx web pages are custom markup, and will have c#, or vb.net code behind (code that you can't see, nor get). IIS and the .net framework will pre-process that aspx page, and the custom .net controls, then run the c#/vb.net code, and THEN spit out standard HTML to the web browser.

    However, without the source code to the aspx page, then you get next to nothing of value or use.

    If you wanted to re-create that web page, then you need to get the ORGIINAL aspx web page - that is going to be source code.

    For example, I might have this simple aspx web page, source code, and a simple grid view like this:

    enter image description here

    now, above is SUPER simple, and VERY little asp.net markup.

    but, the page code and load behind is this:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
        If Not IsPostBack Then
            LoadGrid()
        End If
    
    End Sub
    
    Sub LoadGrid()
    
        Dim strSQl As String =
            "SELECT FirstName, LastName, HotelName, Description FROM tblHotelsA ORDER BY HotelName"
    
        GridView1.DataSource = MyRst(strSQl)
        GridView1.DataBind()
    
    End Sub
    

    So, when that page is used? The .net frame work loads that above markup, runs the .net code, converts the aspx page into standard browser HTML, and we now get this:

    enter image description here

    so, really, the asp.net system, it requires IIS (windows web server), requires the orginal markup, and requires the compiled code behind to work.

    As such, the .net frame work will take that aspx page, and spit out, and create standard HTML output.

    However, that resulting output and web page sent to the browser is VAST VAST different markup, and VAST differnt as to what the orginal source code used for that web page.

    In effect, downloading a page from a web server ONLY gets you the final output - HTML, and does NOT result in a valid aspx web page, nor anything much of use.

    That resulting page might load in a browser if you saved it, but such a page will certainly not work in your Visual Studio web project as a aspx web page. For that you need the source.

    So, how aspx web pages work is a complex dance of .net framework, code behind, and the custom markup in the aspx page, of which you need the orginal source code - of which you don't have, nor get by trying to download a simple web page.

    asp.net really is a HTML processor system, and combined with vb.net (or c#) code behind, then a VERY simple little grid view above becomes that amazing nice HTML table, and required only a few lines of code - and that's why asp.net is so powerful.

    but, downloading the output of the web server, and the resulting aspx web page gets you NOTHING close to what the orignal aspx web page was. It really is of zero use to you as a web developer and even less use if you going to develop an valid aspx web page.

    so, you might see some download button in that resulting markup, but you don't have the c#/vb.net code behind that the button when clicked is going to run. And downloading that page ONLY gets you the markup, you still need the c#/vb.net (code behind) that will run when that button is clicked. So, again, that resulting web page is of little use, and things like buttons in that page will require the original aspx web page, and the c#/vb.net code behind for such buttons to work correctly. When such buttons are clicked, then that whole page is posted back to the .net web server running IIS, and it will figure out the code behind to run for that button click to work. but, just downloading the page? Nope - not even close to working, nor will any of the buttons work either.