Reputation: 57
I want to say it is server-side just from my reading and understanding, but I was hoping for a bit of clarification. Thanks.
Upvotes: 1
Views: 5065
Reputation: 52260
Your codebehind is written in c#. Anything written in c# runs server side. After all, your web pages can be displayed on any device, including devices that lack a .NET CLR; how could they possibly run on an iPhone?
Also, anything that references a .NET object also must run server-side. After all, the client can't talk to .NET objects if it doesn't have a CLR. When you see markup like this
<ASP:Button runat="server" id="MyButton">
...it means that the code is setting properties of a .NET object (in this case, a button). All that is server side code.
Your ASP.NET controls emit HTML markup (among other things) which are returned to the browser and "executed" (parsed) there. The HTML usually isn't present in your code at all; it is generated in real time by your code, usually via a method called Render.
However, markup that is not marked runat="server"
can be inserted into your web pages, and this markup will get sent to the browser along with the generated HTML. For example, only the second line in this example is server-side:
<DIV id="This_Is_Client_Side">
<ASP:Button id="This_Is_Server_Side" runat="server" />
</DIV>
In addition, any Javascript or CSS files in your project will be sent to the browser to run there.
Pretty much everything else is server-side code. Including codebehind.
Upvotes: 4
Reputation: 415901
Code-behind is definitely server-side. It runs on your web server, and not in the user's browser client.
Additionally, anything marked runat="server"
in your *.as?x
files (aspx, ashx, asmx, etc) are handled server-side.
Upvotes: 6