简体   繁体   中英

how to edit a file in an online aspx site?

I'm very new to asp.net ( but an aged PHP developer) ..

I'm now in a situation where I should do some small modification in an online aspx script(using vb.net).

I downloaded the whole site and opened it in visual studio, all the modification I had to do is to make a redirect to another external page after succesful login,I determined the place where I should do my modification inside a file named login.aspx.vb , and added this line in it:

Response.Redirect("My URL Here")

And then uploaded only the modified file again, to get no change at all.

I even tried to modify the success msg that appear after successful login and re-uploaded it to find no change at all ( still showing the old message)

Is there some step I'm missing before uploading the page?

You will need to compile the project, and if using visual studios you can just hit ctrl shift B and it will build the entire solution. Visual studio detects which project in the solution has changed and will compile it. Then do as the other answerer says and upload the .dll file which is a container of your compiled code that will be referenced by the host you upload it to when there is a request for it. (A container is a definite over simplification for more details check: What is a dll?

In ASP.NET there are two types of projects .

  1. Web application project
  2. Web site project

In the first case, when you edit a .vb file you need to compile it with Visual Studio and upload the generated .dll file created in the bin folder.

In the second case you can edit the .vb files and upload them and IIS will compile them.

Based on what you wrote, you are in the first case. In that case you need to have the project / solution files to make any modifications in the .vb files. If you don't have access to those files you could inject some code in the .aspx or .ascx files.

For example:

<%
    Dim flag As Boolean = false
    // Write some code to set the flag

    If (flag) Then
        Response.Redirect("~/default.aspx")
    End If
%>

Using <%....%> you can write code to execute when the page starts to render. This is a bad practice since because it has poor performance since the code is parsed and executed at runtime, while the code in .cs files is already compiled.

But if you don't have the project files you could do minor changes with this hacky approach.

Edit : If you are in the first scenario, you need to build the project and then upload its .dll file which is in the /bin folder. For any changes in the code files you upload only the .dll. If you change the .aspx, .ascx, etc files you need to upload those as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM