C# course and confusion

I have just completed an intense C# course in London, and coming away from it I’m a little confused.

It was paid for by my work and my background is a web developer, so I was asked to go there and then come back and start using what I learnt to replace php on the websites I have created.

When on the course we went through a lot of C# and used visual studio, but we didn’t talk about it being integrated into websites, but I did learn about LINQ which basically fits with what I do perfectly.

So my question is can I use C# in my websites in place of php to communicate with the DB, and display the data on the page, much like how it currently is with PHP.

I also want to update my LinkedIn profile, so what would I write that I use c# and other technologies into my bio, remembering that I am a web developer.

I have just chatted to a friend and I think I am now a bit more clear of what I need to do. C# is going to replace the PHP I have used, I’m to read more into the ASP.NET platform and use MVC. This way through Visual Studio I am told, will allow me to develop websites but its going to be a complete change from the way I have been developing websites for the last 17 years.

Should be good though, as really I needed to move on and this seems to be the way

1 Like

I’ve only worked with C# for a month, but where I was, it was very much used as the back end language for communicating with MSSQL, much like PHP would be with mySQL. It was also used to create/populate HTML templates that would be sent to the browser. From the front end, JavaScript was largely used to make AJAX calls to the C# files. The C# was more or less the “C” in “MVC”, though I’d never suggest that what I was working on fully subscribed to an MVC pattern.

Yes, and so much more! You may want to look into .NET Core if you company primarily hosts on Linux Servers instead of Windows Servers. And even then, if you have customers who have their own hosting… that is yet another potential blocker for C#, because if they are currently not a C#/.NET app, their host might not permit .NET or .NET Core.

It isn’t as simple as uploading C# in place of the PHP files, so be sure you know what the servers support, otherwise, you could be in for a world of hurt.

'Tis true, but remember that just like PHP can communicate with MSSQL, .NET can communicate with MySQL as well, or MongoDB, or <insert_database_here>. The database should be a design decision, not dictated by the language you choose to use.

Eh, not sure I agree with that. TypeScript is primarily preferred for JS in MVC applications, or Angular (maybe both). As for AJAX calls, there are a variety of ways to accomplish that, without writing a lot of JavaScript.

No. C# is just the language, MVC is a pattern and stands for model-view-controller. You can do MVC in PHP, JavaScript, Perl, Python, pretty much any language if you put your mind to it.

1 Like

Thanks cpradio,

Everything here is moving to Windows servers by the looks, so I am guessing this is why I was put on the course. I’ll start with some basic tutorials, and work through it a day at a time.

Its going to be strange working and thinking like this, but I have been told you soon get used to it and have done php and websites for so long now, I was due a change, and I think I will be able to easily jump back to it when the needs arise.

Thanks again

1 Like

Ok another question, I have just opened up a tutorial that says lets build a ASP.NET website in Visual Studio, and the first part mentions Razor. So is this an essential download that I need to upload to VS, as its currently not an option, or do I ignore this, and simply go File/New/HTML Page.

But I must add that I was told that I need to look into MVC too.

Best set off on the right foot, rather than as I have done for the last 17 years of jumping into something from the deep end and not doing things right.

The best tutorial I know of that is recent, is https://docs.microsoft.com/en-us/aspnet/core/tutorials/

As far as Razor Pages go, that is built into AspNetCore.Mvc.

So if you create a new Web Project (make sure it is .NET Core)

Then choose Web Application

It will give you a project with a template that already supports Razor syntax, you can verify this by expanding the Dependencies section under your web application project, then expand Nuget, next expand Microsoft.AspNetCore.Mvc and you should see Microsoft.AspNetCore.Mvc.Razor listed.

Right so by the looks I need to download something, as I don’t see any of that.

The tutorial I need from that list should be - Create a Web API with ASP.NET Core and Visual Studio for Windows. Is that right cpradio, as Im needing to build a website.

All I see after File / New / Project / is below

It seems you may need to download and install .NET Core, maybe even ASP.NET Web Tools 2017 (if that is separate). Generally when you install Visual Studio, it installs many of those things for you…

Well, you may use a Web API, but more importantly, this one would be a good starter

Create an ASP.NET Core app with Visual Studio on Windows

Anything under Building web Applicaitons and Building web APIs are worth going through.

OK, I’m all set up now, and ready to go into my first tutorial, wish me luck!

Thanks cpradio, setting off on the right foot feels good.

1 Like

I probably could have been clearer. That was how C# was used in this one situation. I’m quite certain it was not a ‘best practice’ scenario.

1 Like

Oh, I get it. I initially read your statement to say the C in MVC was for C#, versus C# was utilized to build the Controller part. That makes a lot more sense to me now. I misinterpreted your initial statement.

1 Like

n/w :slight_smile:

Excuse me if I missed it but I don’t see an explanation of whether your site is hosted internally or at a hosting company. You also don’t specify that you are required to use an Apache host and MySQL. If they might consider converting to SQL Server then that might help.

Are you familiar with Entity Framework? It handles many of the details of databases.

Are you familiar with “Web Deploy”? It is like an improved version of Front Page Extensions. It does basically everything that FTP does but Web Deploy does more; it possibly can do much more. Web Deploy can take care of the database(s) too.

So here is what you can do, at least possibly. Use Visual Studio to create a Web Site. That would be done using “File” | “New” | “Web Site” instead of “File” | “New” | “Project”. Create a blank web site. Then you might want to create a Master Page. I think (I aj not sure) that if you create a Web Forms Site then you will get a complete skeleton site with a database and membership information and login capability. I also see a Web Site with Razor.

My Simple Samples site is simple; it does not use a database nor is it deployed using Web Deploy but it was created as a web site in VS. I don’t use Web Deploy because GoDaddy does not support it, at least not for shared hosting, but I hope to switch to a hosting company that does support Web Deploy.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.