How to Run an Un-Built Source ASP.NET C# Website - c#

I am developing a web site using ASP.NET C# and I want to make changes on codes after publish. Every time I need to change something on a .cs file I have to build and publish web site then upload it to the server. Instead, I want to have a use like PHP style. Just make the changes on the source at server-side.
How can I do this if it is possible?

Related

Running a Angular front-end written in TypeScript in a C# Web API project?

Let's say I have an existing ASP.NET Web API project, complete with all the API controllers I need for some service. Previously when using this API, clients just did their typical URI routing to use this API.
Now, with ASP.NET Web API, they provide a simple front end. I'd like to add AngularJS to this, and I see one obvious way to do that, and that's through Angular's JavaScript library. How can one do this with TypeScript? I understand that TypeScript is a language that compiles down into JavaScript, which to me implies that I need to get some step in the build process for Visual Studio (not Visual Studio Code) that builds the TypeScript for my front end.
How can this be done? I have done some tutorials for TypeScript where they have you pull something off NPM that gives you the foundation for your website and you go from there. However, in all of these tutorials, I've done this in Visual Studio Code where you have the Angular CLI and you can ng serve --open to run the web server and develop your website, but I have no clue how to translate this feature into Visual Studio 2017 where both the Web API and the Angular front end are both running at the same time.
I envision the product I'm working on running on IIS and when clients navigate to the page, they'd be served up the Angular front end and the Web API would exist in the back end doing what it does, but I don't know how to marry these two together. Do you need to have two web servers running, one for the Web API and the other for the front end? If you can do it on a single web server, how can it be done? Thanks.
If you have a working API you can run this as normal, say on localhost:8000.
Now you create your SPA (angular or whatever) and run that on localhost:8001.
They run independently, all you do is query your endpoints, obviously passing paramters (say localhost:8000/api/something/3) in order to retrieve the data you're looking for.
If the API is not public, you simply don't expose it as such.

Run C# MVC application, in local web server

I've made a C# ASP.NET Application using VS 2013. What I want to do is use it on my localhost using IIS.
How do I do it work? When it go to localhost, it just appears a black page.
I've created a new site on IIS Manager and ponted it to de fisical path of my application. Registered the ASP.NET on IIS...
I've tried whats in the How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network? .
So, I don't need to use IIS, I could use other web server, like Apache...
I want to be able to open Chrome, go to localhost:8080/ for example and get my application, without having to open VS and run the project etc...
Also, if other people could access the application on my local network, it would be great. I just want to use my MVC web aplication like it was on the internet itself, like I can access google.com and use it, but I want to do so in my local network only.
If I try to access a simple HTML file, using IIS, it works perfectly. Now I want to use my C# MVC web application.
Is there a way to do this? Using IIS, Apache, whatever...

Upload a video using asp.net MVC WebService

I want to upload a video file using asp.net mvc . I am sending the file as postbody. How can this be retrieved later from the server using webservice. I have seen this example . Also this question helped me to understand it more. But I m not sure how to fetch post body.
But no sure how this works. How to do his properly in .net c#
In order for the file to be available later, you need to save it somewhere during the upload - either to a database or a folder on the server. Then, your web service needs to know how to retrieve it from that location.

convert web application to a web site

I have a c# .net VS2010 web application that contains only classic asp files.
What I want to do is convert the web application to a web site to make it easier to manage the classic asp files.
How can I convert from web application to web site? I have researched google and found lots of examples going the other way.
I don't think there's an automated way to do this. You could just create a new website in Visual Studio and copy your files from the web app into this new website. Be sure to go into each and every .aspx/.ascx file and edit the 'Codebehind' attribute so that it reads 'Codefile' (codebehind directive needs to be compiled and thus won't work in an ASP.NET website). You'll also need to delete the Designer/Designer.cs files.
Hopefully you don't have too many files so that this won't be too much of a PITA.

Rebuild ASP.NET Web Application via code

Currently I force ASP.NET to rebuild a web application by changing the web.config. However, I would prefer to do it via C# code (including clearing cache etc). How could I go about doing this.
Are you talking about live, on a web server? You could stop/start the application within IIS, and probably via a PowerShell or WMI script.
Used code from 'Recycling an ASP.NET Application from within' to do this via code.

Categories