New Code without Recompilation - how can this be done?

P

pbd22

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.
 
I

Ignacio Machin ( .NET/ C# MVP )

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="Default.aspx.cs"
Inherits="Default" %>
and n the code behind:
public partial class Default: Page

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top