New Code without Recompilation - how can this be done?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pbd22

    New Code without Recompilation - how can this be done?

    Hi. I have been asked to do a rather odd thing by my employer. I have
    to add a new feature to an old project that "should not know about the
    change". This is a bit of an odd request but just assume that my
    reasons for doing what I need to do cannot change.

    Assume that I need to add a list box to the pre-existing project page
    that uses some server code to grab its value.

    The ony way I can think of doing this is to open notepad on
    the given aspx file (Default.aspx) and add a client script with an
    ajax call to some server page that handles the request and returns the
    value that needs to go in the text box.

    The question I have - is it possible to place the AJAX server page
    under the root level of the project that I cannot recomplie? Will this
    work? Does the project need to "know" about the ajax page or can it
    live in the project without it being complied code? Or, do I have to
    make a call external to the "non-recomplied" project?

    In essense, how can i add a list box to a pre-existing project and
    call values from new server code without recompiling the project?

    I know this is weird but it is what I have been asked to do. :(

    Please help!!

    Thanks.
  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: New Code without Recompilation - how can this be done?

    On Jun 29, 9:14 pm, pbd22 <dush...@gmail. comwrote:
    Hi. I have been asked to do a rather odd thing by my employer. I have
    to add a new feature to an old project that "should not know about the
    change". This is a bit of an odd request but just assume that my
    reasons for doing what I need to do cannot change.
    >
    Assume that I need to add a list box to the pre-existing project page
    that uses some server code to grab its value.
    >
    The ony way I can think of doing this is to open notepad on
    the given aspx file (Default.aspx) and add a client script with an
    ajax call to some server page that handles the request and returns the
    value that needs to go in the text box.
    >
    The question I have - is it possible to place the AJAX server page
    under the root level of the project that I cannot recomplie? Will this
    work? Does the project need to "know" about the ajax page or can it
    live in the project without it being complied code? Or, do I have to
    make a call external to the "non-recomplied" project?
    >
    In essense, how can i add a list box to a pre-existing project and
    call values from new server code without recompiling the project?
    >
    I know this is weird but it is what I have been asked to do. :(
    >
    Please help!!
    >
    Thanks.
    Hi,

    Well you might be even more surprised to know that it can be done :)
    First, you need to modify the aspx, in there you change the @page
    directive and especifically the Inherits attribute , you set the new
    value to the name of a class you are going to create: MyClassA

    then you make this new class inherit from the "old" class:
    so if you have this:
    <%@ Page Language="C#" Codebehind="Def ault.aspx.cs"
    Inherits="Defau lt" %>
    and n the code behind:
    public partial class Default: Page

    you end with
    <%@ Page Language="C#" Codebehind="Def ault1.aspx.cs"
    Inherits="myNew Page" %>
    and n the code behind:
    public partial class myNewPage: Default


    Comment

    Working...