convert .cs file to aspx.cs file

I thought I could just put my same cs code into this file that would open a webpage but apparently things are different. I need this because I have a login file that has three options for the user, the page I am building takes in their username, authorization and database information and then outputs all of that into a text file. The problem is I have to link the .cs file to the asp.net file and it is really complicated (for me).

I am new to coding so any help or suggestions would be greatly appreciated. Also if you have any tutorials or websites that could assist me that would be great!

Ae you using visual studio to build the pages? This should have been taken care of automatically. Your .aspx page needs a directive at the top pointing to the code behind file to use:

<%@ Page language="C#" codebehind="your .cs file" inherits="" %>

Yes I am using visual studio. I built the page with c# with a .cs file. I made a login page in asp.net and I need the page to come up when the option of the .cs file comes up. Right now it is just giving me an error so I know I need to somehow link it to the login page.

Would it be easier to just make it an aspx.cs file or keep it mine and add some sort of code to make it link and come up as a webpage?