Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7792809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:18:01+00:00 2026-06-01T22:18:01+00:00

I am learning some aspx and had a question. I have the following example

  • 0

I am learning some aspx and had a question. I have the following example code:

<%@ Page Language="C#" %>
<html>
<body>
    <form id="form1" runat="server">
       Current server time is <% =GetTime()%>.
    </form>
</body>
</html>

Now what i dont understand here is that if the form is running at server already, why do we need the <% %> code blocks again? Maybe im not understanding the distinction between the code blocks and the whole running at server on the page. Can anyone please clear up my misconceptions about what is happening here? I just dont really understand the serverside vs clientside terminology for an aspx page.

I have also seen code like this:

<script language="VB" runat="server">
Dim ....

Public Sub PageLoad()
...
Response.Write("Hello")
End Sub
</script>

<% If dataExists(whatever) Then %>
HelloWorld

Now why couldnt the codeblocks be eliminated above? I mean in the server tags, that code is already running server side and making some write requests. Then you have code blocks which are doing some logic check to write again. Why separate these? Arent they the same functionality or am i missing something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:18:03+00:00Added an answer on June 1, 2026 at 10:18 pm

    Let’s make clear a thing from start. You are not learning aspx, unless you’re trying to find out about this file extension, you’re learning ASP .Net and more specific ASP .Net Web Forms.

    The markup from the Web Forms (the code in the aspx file) is parsed by ASP .Net, then a class will be generated, which is going to be used later to actually create the HTML.

    This markup can contain pure html, server controls (<asp:Label />, etc), code blocks, DataBinding expressions, resources expressions and many more.

    All these are just parsed to obtain that generated class. The generated class will contain more or less instructions for a writer to write some strings (html if you want).

    Probably you’ve seen this example and now you can find out this is some kind of syntax sugar.

     <% { Response.Write(DateTime.Now.ToString()); }%>
    

    vs

     <%= DateTime.Now.ToString() %>
    

    It produces the same thing, but is written in two different ways. That syntax is just parsed.

    There is only one difference between server code and client code: server code runs on server and client code runs on client. That client code is (or might be) produced by the server so the client can run it on its side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning some COM code and the following code puzzled me. STDMETHODIMP _(ULONG)
Looking at learning some C since i saw in another SO question that is
i have done some learning on struts based on one project that i got.Now
My team is learning some Erlang in my new job. Right now we have
I am learning some WPF/C# so this question might be silly for some of
I have been recently learning some OOP PHP and seem to have run into
I've been learning some Clojure, and I currently have a single .clj file which
I have Googled it, and found the following results: http://icfun.blogspot.com/2008/03/regular-expression-to-handle-negative.html http://regexlib.com/DisplayPatterns.aspx?cattabindex=2&categoryId=3 With some (very
I have never worked on jquery but after some googling and learning I have
I have started learning some web development lately and have noticed lot's of sites

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.