Publishing ASP.NET files to hosting server and back to local machine.Step by step procedures - asp.net

I am very new with ASP.NET. I need help understanding the basic procedures of how a developer publishes their site to their hosting server, and then once its compiled and published, how does another developer (someone who does not have the original files), edit some of the code behind files.
For example, Developer A creates a site, uploads it to the server and it works great. We hire a new remote developer (Developer B) and he needs to work on a .cs file, does he need to get a copy of the entire site, to his local machine? if so, does he need to reverse the compiling process to get thos .cs files back?
I am a PHP developer, and since theres no compiling needed, I dont worry about .dlls nor about compiling at all. This would truly help me understand ASP.NET with the hopes that it can also help others like me.
Please help. Thank you in advance.

You do not need a copy of the entire site.
But you need the basic struct of an asp.net site, and what resource you may need to run this individual page.
The minimal basic struct of an asp.net site is this two directories (and the content of them - if any)
App_Code
Bin
together with the web.config that is probably needs some changes to run to the remote developer.
Now some simple logic.
If a page have css, javascript and other files you need them too
If a page need connection to some database, you need that too
In the bin directory you may only give the dlls/libraries that this individual page use (if any)
If the page have links to other pages, or post to other pages, or need ajax call from other pages you need them too.
If some one change some functions on the dll files, you must give the update to the remote developer so he can adapt his code.
After the update he can upload the aspx + cs file on the server.

Related

Rooted Path and FileUpload Control

I know it's been asked and I have read the posts and Googled this all day. Still nowhere near something that works. Using an .aspx page, I need to upload a .pdf file to a specific website. I'm doing development using VS2017 and VB.Net. The app will run on different websites. It needs to upload client files to a specific different website and path. Also, the file name of the uploaded file will not be the same as the local source file. Creating the new name is no problem.
Let's say a local file must be uploaded to a website at https://www.appfileserver.co.za/pdfdocs, but I'm on https://www.myownsite.com. So, when using FileUpload1.SaveAs(rootedpath) the path that goes in there must be the rooted path to the target. What would the rooted path look like for the example I provided?
FYI, I know the IP addresses, http paths and anything else I need to know because I control those sites. It would be great to do an FTP upload. I have done this many times from desktop apps. Unfortunately I'd need the full path to the local file. It seems there is no way a web page is allowed to get that full path, so FTP upload is out - or is there a way?
After battling for two days trying to FTP upload from website to website (which is not possible because server firewalls block this), I finally solved it. The solution was a simple one. I deployed the upload .aspx file on the target server then embedded that in an iframe on the client machine apps. The files are then uploaded one time to the right place. Simple and 100% effective. Hopefully somebody see's this and understands it - so as to avoid the troubles I had.

ASP.Net Accessing Server Filesystem

I am having trouble accessing information on the server my website it on. As the website was originally programmed with VB.Net, I cannot change the language without having to completely reboot the website. The way the website and server are configured, I can only use ASP.Net and VB.Net.
I am needing to add a section where they can create folders, edit folder names, and upload pictures and text documents on the server through the public website. I tried using parts of the FileIO, Server, and Http that should have worked, but none of them did. Most of my research is about local files and text documents.
I have not been able to find any information that works. Can someone help me? Thank you.
Firstly, creating a virtual directory in ISS mapped to somewhere on your disk would be a good start. This way you have a separate folder for user data in a folder with write access (make sure IIS has write access to the folder!), and the folder is not affected by website deployments.
Secondly, you might need to resolve absolute path for most of the System.IO.File calls. See How to convert a relative path to an absolute path in a Windows application?, just you will need to convert this code to VB.

Can I alter an aspx.vb file on the fly on a live website?

I need to know if it recompiles my site at all or if there are any issues doing this. I have tested the changes locally and in a test environment and I don't want to do a full deployment for one tiny change. I'm just not familiar with aspx.vb files and how they interact with a website.
The short answer is yes, it will cause the page to be dynamically recompiled. Dependencies could cause the entire site to be recompiled.
For more information read this MSDN article: Understanding ASP.NET Dynamic Compilation. The "Recompiling on Change" section addresses your question.
You can modify an .aspx.vb file and drop it into its respective location on the server, overwriting the existing file, and it will be dynamically compiled due to the change. However, if you were referring to having code that changed .vb file content on the fly, that sounds like a bad idea and you should reconsider your problem and approach.

Deploying a Pre Compiled Web Site Project

So I have a website project, which I precompile when I publish.
I have a question, when I need to make a small change to the deployed site, do I have to rebuild, re-publish and deploy the entire website structure again, or can I just copy the modified aspx page and the bin directory?
Please let me know!
Thanks guys!
It is going to depend on how you did the precompiling of the site.
According to MSDN, if you did a precompile for deployment, the process takes aspx files and processes any internal code in them, so you will need to recompile everything.
If you did a precompile for deployment and update, the aspx files are not taken into consideration, so provided all you did was some UI changes, you can push the updated aspx file up without issue.
You should be able to republish locally and then copy up the modified published pages and the bin folder.
You shouldn't need to upload everything.
If you pre-compile epending on the options you have chosen you may be able to edit the .aspx page i.e. HTML code, but not the code-behind..
If the .aspx pages become just placeholders i.e. they are empty inside except for a single comment, you cant.

How do you update an ASP.NET web application?

Simple question. If you have a compiled and published ASP.NET web application running on a server and you need to update, say, a line in one of the codebehind files. Do you shut down the entire site, republish, then load the site back up? Or do you publish straight to your live site with users still using it?
For myself, place an app.offline app_offline.htm file into the site, then overwrite the entire website with the latest published build.
there are a few options when building a site -> one dll for the site or one per page. if u just updated one line in a code behind, and you have chosen the build option for one per page, then you can just copy/paste that new page dll.
i don't like that method personally. I find it simple to app_offline.htm the site.
If it is a single file and a simple site that uses that app_code folder to store the code behinds, I simply xcopy up the new files. If I use http expiration headers I may need to do some better scheduling to make sure things like javascript files and css sheets match the rest of the site that was updated.
For emergency patches:
If its just a codebehind file, I copy the entire /bin/ out and replace all DLL's (mostly out of habit)
If its an aspx, I just copy the aspx.
For actual deployments, I have an automated system that checks out the code from source control, builds a clean release build, takes the site offline, and then robocopies it out to the deployment target. Its a one click process (Thanks CruiseControl!).

Resources