1

This is my first post here. I am doing a college project and I am stuck in an error.

I am building an e-learning website in ASP.net and they are static pages. Now, when I am opening a contact-us form it is throwing me an error.

Error Page

Contact us form is in another folder.

Link page

I am a noob :( Please explain me in easy way.

2 Answers 2

1

enter code hereThe error you are getting means that there is no file called default.aspx.cs in the same directory as your default.aspx file. Please make sure that this file exists. You may have deleted it, or moved it to a different location.

Your IIS is trying to link the default.aspx.cs, which is the code file, to the default.aspx file, which is your HTML file, which uses the code.

You can see the link between the files at the top level declarations in your ASPX file: "Codefile = default.aspx.cs"

If you cannot file the default.aspx.cs file, I suggest you re-create the ASPX file using your development editor. This will create the default.aspx.cs file automatically under your ASPX file.

From MSDN:

The code-behind page model for Web Forms allows you to keep the markup in one file—the .aspx file—and the programming code in another file. The name of the code file varies according to what programming language you are using. For example, if you are working with a page named SamplePage, the markup is in the file SamplePage.aspx and the code is in a file named SamplePage.aspx.vb (for Visual Basic) and SamplePage.aspx.cs (for C#).

Hope this helps.

Sign up to request clarification or add additional context in comments.

3 Comments

This is just because I have name the file as index.aspx ??? Just because the .cs file is already present
Please read my answer - you need to check for the '.cs' file called default.aspx.cs
Check this one out I am not getting the .cs file but in file manager it is present :( ![2.png](postimg.org/image/z5bl5cz07)
0

Well! The issues was I didn't selected the C# and my project was on vb. This is the reason why it thrown me that error.

If this error comes we need to make sure what files we are having and in which language we are making project :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.