Print Page | Close Window

Compile a project

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=6865
Printed Date: 29 March 2026 at 8:32am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Compile a project
Posted By: Boecky
Subject: Compile a project
Date Posted: 31 October 2003 at 1:35am

When I'm finished developing a asp.net site, and I'll release it, I need to compile it...I have have some questions about it.

Am I correct that I do the following to create the final version:
-in the web.config file:
<compilation defaultLanguage="vb" debug="true" />
Change debug to false

-And in vs.net change the select menu to RELEASE and then build the solution.

Is this all I have to do or are there more things? Do I really need to change the select menu to release?




Replies:
Posted By: dpyers
Date Posted: 31 October 2003 at 7:41pm

        <compilation debug="false" />
        <customErrors mode="RemoteOnly"/>

Compiling as "Release" removes the custom debug flags from youe compiled code.

The web.config compilation debug entry set to false prevents asp.net from tracking flags (even if they don't exist) when the code executes.

The changing the customErrors mode from "off" to "RemoteOnly" disables stack traces and detailed debug info from displaying and thereby providing info to hackers.

All 3 also improve performance f your released app.



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: Boecky
Date Posted: 02 November 2003 at 10:14am
Ok, and what if I want to build a Class Library? I build it as 'release'...and that's all?


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 2:24pm

This is copied straight from the VS.NET help, it's explaining how to make high performance applications

As with any programming model, writing code to create an ASP.NET Web application has a number of pitfalls that can cause performance problems. The following guidelines list specific techniques that you can use to avoid writing code that does not perform at acceptable levels.

  • Disable session state when you are not using it. Not all applications or pages require per-user session state, and you should disable it for any that do not.

    To disable session state for a page, set the EnableSessionState attribute in the @ Page directive to false. For example, <%@ Page EnableSessionState="false" %>.

    Note   If a page requires access to session variables, but will not create or modify them, set EnableSessionState attribute in the @ Page directive to ReadOnly.
    Session state may also be disabled for XML Web service methods. For more information, see ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconaspnetbuildingwebservicesaspnetwebserviceclients.htm - XML Web Services Created Using ASP.NET and XML Web Service Clients .

    To disable session state for an application, set the mode attribute to off in the sessionstate configuration section in the application's web.config file. For example, <sessionstate mode="off" />.

  • Choose your session-state provider carefully. ASP.NET provides three distinct ways to store session data for your application: in-process session state, out-of-process session state as a Windows service, and out-of-process session state in a SQL Server database. Each has it advantages, but in-process session state is by far the fastest solution. If you are only storing small amounts of volatile data in session state, it is recommended that you use the in-process provider. The out-of-process solutions are primarily useful if you scale your application across multiple processors or multiple computers, or where data cannot be lost if a server or process is restarted. For more information, see ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconaspstatemanagement.htm - ASP.NET State Management .
  • Avoid unnecessary round trips to the server. While it is tempting to use the time and code-saving features of the Web Forms page framework as much as you can, there are circumstances in which using ASP.NET server controls and post-back event handling are inappropriate.

    Typically, you need to initiate round trips to the server only when your application is retrieving or storing data. Most data manipulations can take place on the client in between these round trips. For example, validating user input from HTML forms can often take place on the client before that data is submitted to the server. In general, if you do not need to relay information to the server to be stored in a database, then you should not write code that causes a round trip.

    If you develop custom server controls, consider having them render client-side code for browsers that support ECMAScript. By using server controls in this way, you can dramatically reduce the number of times information is unnecessarily sent to the Web server. For more information, see ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpcondevelopingwebformscontrols.htm - Developing ASP.NET Server Controls .

  • Use Page.IsPostback to avoid performing unnecessary processing on a round trip. If you write code that handles server control post-back processing, you will sometimes want other code to execute the first time the page is requested, rather than the code that executes when a user posts an HTML form contained in the page. Use the Page.IsPostBack property to conditionally execute code depending on whether the page is generated in response to a server control event. For example, the following code demonstrates how to create a database connection and command that binds data to a DataGrid server control if the page is requested for the first time.
    Sub Page_Load(sender As Object, e As EventArgs)
            ' ...Set up a connection and command here....
            If Not (Page.IsPostBack)
                Dim query As String = "select * from Authors where FirstName like '%JUSTIN%'"
                myCommand.Fill(ds, "Authors")
                myDataGrid.DataBind()
            End If
    End Sub

    Since the Page_Load event executes on every request, this code checks whether the IsPostBack property is set to false. If so, the code executes; otherwise, it does not.

    Note   If you did not run such a check, the behavior of a post-back page would not change. The code for the Page_Load event executes before server control events execute, but only the result of the server control events would render to the outgoing page. If this check is not run, processing is still performed for the Page_Load event and any server control events on the page.
  • Use server controls in appropriate circumstances. Review your application code to make sure that your use of ASP.NET server controls is necessary. Even though they are extremely easy to use, server controls are not always the best choice to accomplish a task, since they use server resources. In many cases, a simple rendering or data-binding substitution will do. The following example demonstrates a situation in which using a server control is not the most efficient way to substitute values into the HTML sent to the client. Each method sends the path to an image to be displayed by the requesting browser, but using server controls is not the most expedient method shown, since the Page_Load event requires a call to the server for processing.
    <script language="VB" runat="server">
    
        Public imagePath As String
        Sub Page_Load(sender As Object, e As EventArgs)
            '...Retrieve data for imagePath here....
            DataBind()
        End Sub
    
    </script>
    
    <%--The span and img server controls are unecessary.--%>
    The path to the image is: <span innerhtml='<%# imagePath %>' runat="server"/><br>
    <img src='<%# imagePath %>' runat="server"/>
    
    <br><br>
    
    <%-- Use data binding to substitute literals instead.--%>
    The path to the image is: <%# imagePath %><br>
    <img src='<%# imagePath %>' />
    
    <br><br>
    
    <%-- Or use a simple rendering expression...--%>
    The path to the image is: <%= imagePath %><br>
    <img src='<%= imagePath %>' />


Posted By: Boecky
Date Posted: 06 November 2003 at 3:13pm

tkx!
I should use that help function more




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net