Establishing binding between css and c# and sql
Hello, I made a login page with CSS, but I don't know how to connect it with C# and SQL. Can anyone help me with this?
22 Replies
you need a backend that serves your page and handles the form submission to do whatever you want to do in the database
$helloaspnet
Get started with ASP.NET Core
A short tutorial using the .NET CLI to create and run a basic Hello World app using ASP.NET Core.
I know I will do this with C# but I don't know how to put the connection. And frankly I don't understand much from these articles.
you will make an ASP.NET Core project of some kind and build your page there whether that's MVC, Razor pages, Blazor, etc
you don't usually connect a plain html/css page as-is
You need an Api interface
Tutorial: Create a web API with ASP.NET Core
Learn how to build a web API with ASP.NET Core.
i mean, that's an option but won't work properly if all they have is a single static page
we need $details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
So, do I need to build the website I want to create via C#? As far as I understand, what I write with CSS will just stay that way.
you can't write a page with just css
you have html too, and usually some javascript for interactivity
but you don't want it to stay that way, right? you want someone to be able to type in a username and password, submit, and be redirected based on whether they put in vaild credentials or not
of course
so you need a backend that can do that and send new pages/set cookies based on their input
this is a more specific guide you can try https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-8.0&tabs=visual-studio
Introduction to Razor Pages in ASP.NET Core
Explains how Razor Pages in ASP.NET Core makes coding page-focused scenarios easier and more productive than using MVC.
fyi, i don't respond to DMs from this server
Okey
So, is there a chance to transfer the login page I wrote in vs code to c#?
yes, look through that guide and you'll see that the .cshtml files are similar to plain html files
Thank you very much I am new to these topics. Thanks for your help I didn't think making a website would be this complicated
technically what you have now is a website, but making websites interactive with logic is more complicated yeah
How long does it take to make an interactive website on average?
impossible to tell
it depends on your skill level and the complexity of the site
It is actually a simple site, user login, after logging in, the rules and information are fixed things.