Pages from multiple assemblies

Y

Yofnik

Hello,
We have developed a web application that provides a specific set of
functionality. Our customers may want to add a few additional ASP.NET
web pages to this web application to provide some additional custom
functionality.

We do not want to provide them with the code for our "base" set of web
pages. Ideally, we would like the pages they develop to reside in
another assembly to keep the code bases separate.

Can pages from both of these assemblies run in a single web
application? I did a quick test and could not get this to work. How
would I go about doing this? If its not possible what are my other
options for handling a scenario like this?

If possible, I would like to avoid having a whole new Virtual
directory web application as I would like to share the same security
settings, database connections, styles, images, and general look and
feel.

Any advice is appreciated.

Thanks,
Yofnik
 
Y

Yofnik

It doesn't seem to work. Here is what I tried. I have my base web
application, called BaseApp, that resides in C:\Inetpub\wwwroot
\BaseApp. The code behind is compiled into BaseApp.dll and that file
is in the bin directory.

Now I want to add some pages whose code behind is compiled into a
different assembly. As a test, I created a new web application called
CustomApp with one page called CustomPage. I then copied the
CustomPage.aspx to C:\Inetpub\wwwroot\BaseApp and copied
CustomPage.dll to C:\Inetpub\wwwroot\BaseApp\bin.

When I try to access http://localhost/BaseApp/CustomPage.aspx, I get
the following error:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure
that it is spelled correctly.

Is there a directive or something I need to change in the
CustomPage.aspx that tells it which assembly the code behind resides
in?

Thanks.
 
Y

Yofnik

Sorry...I didn't include the code because it is very trivial. Here is
the custom page (that I wish to include in a separate assemply).

CustomPage.aspx:
--------------------------
<%@ Page language="c#" Codebehind="custompage.aspx.cs"
AutoEventWireup="false" Inherits="CustomApp.CustomPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5
name=vs_targetSchema>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id=Form1 method=post runat="server">
<asp:Button id=Button1 style="Z-INDEX: 101; LEFT: 632px; POSITION:
absolute; TOP: 120px" runat="server" Text="Echo It" Width="128px"></
asp:Button>
<asp:TextBox id=_inputText style="Z-INDEX: 102; LEFT: 152px; POSITION:
absolute; TOP: 120px" runat="server" Width="472px"></asp:TextBox>
<asp:Label id=_echoText style="Z-INDEX: 103; LEFT: 136px; POSITION:
absolute; TOP: 192px" runat="server" Width="616px" Height="48px"></
asp:Label></FORM>
</body>
</HTML>

CustomPage.aspx.cs:
-----------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace CustomApp
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class CustomPage : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox _inputText;
protected System.Web.UI.WebControls.Label _echoText;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
_echoText.Text = _inputText.Text;
}
}
}
 
Y

Yofnik

I also don't see that you have called any assemblies for use by the page

What do you mean by this? How do you do this?

What I am trying to figure out is this - for a given ASPX document,
how does ASP.NET know which assembly the code behind is implemented
in? Can I control this at all if I want to have some pages in one
assemply and others in another assembly.
 
J

Jon Paal [MSMD]

I don't see any errors, but I don't do C#.

I also don't see that you have called any assemblies for use by the page
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top