Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Updating an asp.net 2.0 website

Options
  • 25-02-2010 1:47pm
    #1
    Registered Users Posts: 21,257 ✭✭✭✭


    I've a question about updating aspx pages after they are published. If I publish a website with the "Allow this precompiled site to be updateable" box checked, I can easily update an aspx page and it works fine.

    However, you can't replace the aspx file in your project with the published version as it references the compiled dll in the app_code folder. You need to manually merge the changes from what I can see.

    So, is this just a way to allow aspx pages to be updated after compilation if republishing and uploading the website is not an option - but any updateable content should really be in an external file that's included by the aspx page (e.g. an ascx or text file)?

    The reason I ask is that I'm looking at an FTP-based CMS that doesn't seem to work too well with include files. It works exactly as expected with aspx pages, but manually merging the updated aspx pages and the ones in my project is not an option.

    Edit - here are the differences between the source file and the published file:

    Source file:
    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
    

    Published file:
    <%@ page language="C#" masterpagefile="~/MasterPage.master" autoeventwireup="true" inherits="_Default, App_Web_j2yn-pm4" title="Untitled Page" %>
    


Comments

  • Registered Users Posts: 128 ✭✭johnny_rambo


    I have an answer to this but it takes a bit of effort! :eek:

    Try the following....

    1) Install the Microsoft Visual Studio 2005 - Update to Support Web Application Projects
    2) Install the Microsoft Visual Studio 2005 Team Suite Service Pack 1
    3) Create a new website by selecting 'File > New > Project > ASP.NET Web Application'.
    4) Add the files from your old project to this new project.

    When you create your website as a ASP.NET Web Application, the publish action doesn't change the inherit attribute of the page tag at the top of your ASPX page. The local ASPX will be identical to the published ASPX page.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Hi johnny_rambo - that's looking good so far, thanks so much for your help. I need to deploy and test the site, but the pages are identical as you said.

    I notice that the normal folders like App_Code aren't available to add. Is this a problem?


  • Registered Users Posts: 128 ✭✭johnny_rambo


    No, just place the files you had in the App_Code folder anywhere in your new project. You can create a new folder in the web application project called App_Code if you like but it won't have the same meaning as the App_Code folder in your previous website project.

    A web application project compiles all your project class files and code behind into a single dll and places it into the bin folder (unless you mark a class file build action as 'content'). All code files build action is defaulted to 'compile' and you should have no reason to change this unless, for example, you need to add class files to the server without recompiling the project in visual studio. I've never needed to do this so I always just place all my class files in a classes folder in the project and leave the build action as 'compile' on all classes.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Brilliant, thanks again. I think that's exactly what I was looking for.


Advertisement