[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1982
  • Last Modified:

how to open a .cs file

How do I open a .cs file?

The code looks like C# asp.net


Thanks.
0
duckers1234567890
Asked:
duckers1234567890
  • 3
1 Solution
 
jnhorstCommented:
That's what it likely is.  You can view it using any text editor as it ASCII text.  If you have Visual Studio you can use that too.  Just note that if you change it, the project has to be recompiled for any changes to be applied.  The .cs files are compiled into a dll file usually in a bin folder of an asp.net application.

John
0
 
duckers1234567890Author Commented:
how do I run it?  In a web browser? or called upon as an include?

Thanks.
0
 
jnhorstCommented:
You don't really "run" it.  When you create an aspx page, Visual Studio creates the .cs file as what is called "codebehind".  It is an object-oriented representation of the page.  When you compile the application, the classes defined in the .cs files all get compiled up into what is called a "namespace".  If you look at an aspx page, the very first line (usually) has what is called a Page Directive.  In that element is an attribute like this: Inherits="namespace.pageclass".  SO if I had an application named WebApp1 and a page in this app called start.aspx, this would be Inherits="WebApp1.start".

When a user requests start.aspx, that element tells the asp.net runtime running under IIS to try to instantiate the "start" class in the WebApp1 namespace that is all defined in the dill file for the app, which is created when the app is compiled.  In fact, when a developer creates a site on a development machine, the .cs files should not be copied onto the server, as when the app is actually run, they are not used, not even as includes.

John
0
 
jnhorstCommented:
Question: are these files like this: "start.aspx.cs" ("start" could be any filename).

John
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now