#Need a better understanding of ASP.NET

1 messages · Page 1 of 1 (latest)

arctic hedge
#

Hello.
Is ASP.NET using Javascript for frontend and C# for backend? or is it something else.
If it's something else, can I use js and c# together in asp.net?

past lake
#

Yes, ASP.NET uses JS (or TS) for frontend and C# for backend.
The way you do interaction between them, is using endpoints (in pages or controllers, based on your project setup; I suggest you look into that yourself).

Alternatively, I think you can use Blazor to write both front- and backend in C# (though you might be missing some features as Blazor transpiles C# code to JS).

sour pewter
#

Razor pages are also a possibility but isn't pushed all that much anymore.

@past lake do you have a source for Blazor transpiling to js? As far as I know it's either server side rendering or WebAssembly with JS interop, but that doesn't make it JS LUL

past lake
#

It might have been interop as well; the Blazor page has a heading entitled "JavaScript interop", but the information popup talks about js transpilation.

arctic hedge
#

Alright! Thank you all

woven knoll
#

It compiles to WebAssembly

#

So it completely bypasses any interaction with JS (though you can have it communicate with JS and live side-by-side, but.... idk why you would really want that in most cases tbh)

#

So you can use C# for both front and backend. Just C# full stack the whole way. ASP.NET lets you do this

arctic hedge
#

Wait

#

So how can I use C# for backend and JS for frontend

sour pewter
#

Use asp.net and a js frontend framework

#

VS/dotnet comes with templates for it

sour pewter
woven knoll
#

Fair

#

I haven't experimented much with Blazor so I don't know how capable it is rn