Simple question to the group...

Discussion in 'ASP .Net' started by Blue Streak, Mar 12, 2009.

  1. Blue Streak

    Blue Streak Guest

    What is the difference between having code in an ASPX page like this:

    <script language="VB" runat="server">
    .... .NET code here...
    </script>

    vs.

    <%
    .... .NET code here...
    %>

    TIA...
     
    Blue Streak, Mar 12, 2009
    #1
    1. Advertisements

  2. Blue Streak

    bruce barker Guest

    whether the code is defined in a method, or outside a method in the page
    source code. don't know vb but in c# its:

    class mypage
    {

    // runat server code goes here



    void createobjmodel()
    {
    // createParsedObjectsBefore
    // <% code %>
    // createParesedObjectsAfter
    // <% more code %>
    }
    }


    this usually means that <script runat=server> can only have methods,
    class variables and properties. <% %> can only have inline code (what is
    legal inside a method.


    -- bruce (sqlwork.com)



    Blue Streak wrote:
    > What is the difference between having code in an ASPX page like this:
    >
    > <script language="VB" runat="server">
    > ... .NET code here...
    > </script>
    >
    > vs.
    >
    > <%
    > ... .NET code here...
    > %>
    >
    > TIA...
     
    bruce barker, Mar 12, 2009
    #2
    1. Advertisements

  3. Blue Streak wrote:
    > What is the difference between having code in an ASPX page like this:
    >
    > <script language="VB" runat="server">
    > ... .NET code here...
    > </script>
    >
    > vs.
    >
    > <%
    > ... .NET code here...
    > %>


    Think about how easy it is going to be to maintain the page, looking through
    all the code interspersed with html, and getting all the <% and %> matched.

    Then change to using code-behind rather than either of the above :)

    Andrew
     
    Andrew Morton, Mar 12, 2009
    #3
  4. Blue Streak

    Hillbilly Guest

    Until we take a look at the ASP.NET MVC architecture which takes us
    backwards in time to embed code in HTML all over again as we did in ASP.


    "Andrew Morton" <> wrote in message
    news:...
    > Blue Streak wrote:
    >> What is the difference between having code in an ASPX page like this:
    >>
    >> <script language="VB" runat="server">
    >> ... .NET code here...
    >> </script>
    >>
    >> vs.
    >>
    >> <%
    >> ... .NET code here...
    >> %>

    >
    > Think about how easy it is going to be to maintain the page, looking
    > through all the code interspersed with html, and getting all the <% and %>
    > matched.
    >
    > Then change to using code-behind rather than either of the above :)
    >
    > Andrew
    >
     
    Hillbilly, Mar 12, 2009
    #4
  5. MVC will not require any "code" on the page. What little markup you _will_
    have to write will drastically reduce the amount of ASPX markup you'll have.
    Turn the volume down on the FUD a little. ;)

    "Hillbilly" <> wrote in message
    news:...
    > Until we take a look at the ASP.NET MVC architecture which takes us
    > backwards in time to embed code in HTML all over again as we did in ASP.
    >
    >
    > "Andrew Morton" <> wrote in message
    > news:...
    >> Blue Streak wrote:
    >>> What is the difference between having code in an ASPX page like this:
    >>>
    >>> <script language="VB" runat="server">
    >>> ... .NET code here...
    >>> </script>
    >>>
    >>> vs.
    >>>
    >>> <%
    >>> ... .NET code here...
    >>> %>

    >>
    >> Think about how easy it is going to be to maintain the page, looking
    >> through all the code interspersed with html, and getting all the <% and
    >> %> matched.
    >>
    >> Then change to using code-behind rather than either of the above :)
    >>
    >> Andrew
    >>

    >
     
    Michael Earls, Mar 24, 2009
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    1,132
    Daniel Frey
    Jan 12, 2005
  2. Akaketwa
    Replies:
    1
    Views:
    6,367
    impaler
    Sep 22, 2006
  3. Replies:
    10
    Views:
    541
    Marcus Kwok
    Mar 28, 2006
  4. Replies:
    0
    Views:
    775
  5. christopher taylor
    Replies:
    0
    Views:
    565
    christopher taylor
    Sep 17, 2008
  6. cpld-fpga-asic
    Replies:
    13
    Views:
    1,439
    rickman
    Jul 6, 2009
  7. Oli

    simple simple question

    Oli, Jan 26, 2004, in forum: ASP General
    Replies:
    10
    Views:
    628
    Roland Hall
    Jan 26, 2004
  8. Dag Sunde
    Replies:
    0
    Views:
    269
    Dag Sunde
    Nov 18, 2005
Loading...