Kevin Chun
Kevin Chun

Reputation: 3

ASP.net code understanding concept?

Im just wondering why the fragment of the ASP.NET code for the control cannot be seen in the corresponding web browser code?

For example, asp.net code:

asp:Button ID="Button1" runat="server" style="margin-left: 427px" Text="Submit" 

Browser code:

input type="submit" name="ctl00$ContentPlaceHolder1$Button1" value="Submit" 
      id="ContentPlaceHolder1_Button1" style="margin-left: 427px" 

Upvotes: 0

Views: 125

Answers (4)

cat916
cat916

Reputation: 1361

Basically, ASP.NET is web framework base on a Single Form Model, all server controls that should be put inside a form that run at server. From ASP.NET 2.0 until now, you can use multiple forms as well, however, one form would be active at runtime.

ASP.NET server control <asp:Button ID="something" runat="server"></asp:Button>that would generate <input type="button" id=""></input> - a unique id was generated by ASP.NET framework and started by ctl100.

Upvotes: 0

Imtiaz Zaman Nishith
Imtiaz Zaman Nishith

Reputation: 490

It is not possible to see the code behind because ASP.NET is a server-side Web application framework. You can't see the code without physical or remote access to the server itself.

You could also in theory misconfigure the IIS server to display the source files, and that would cause them to be displayed, rather than compiled, but no idea why anyone would do that. IIS by default will not display them.

Upvotes: 1

LittleSweetSeas
LittleSweetSeas

Reputation: 7084

Asp.Net is a framework used to build web-pages which necessarily have to be rendered as standard HTML pages - otherwise, they won't work in browers.

So, any particular ASP.NET tag is interpreted and replaced by the CLR before outputting the page to the client.

Upvotes: 1

svanryckeghem
svanryckeghem

Reputation: 923

Tags prefixed with "asp:" are processed by the server-side logic, and never make it to the client. The server converts them to HTML constructs.

Upvotes: 1

Related Questions