473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pages from multiple assemblies

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

Mar 14 '07 #1
8 1160
Pages can use, or not use, any or all assemblies.

"Yofnik" <yo****@comcast.netwrote in message news:11**********************@y66g2000hsf.googlegr oups.com...
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

Mar 14 '07 #2
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.

On Mar 14, 11:22 am, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @
everywhere dot comwrote:
Pages can use, or not use, any or all assemblies.
Mar 14 '07 #3
without seeing example http://localhost/BaseApp/CustomPage.aspx code I can offer no assistance.
"Yofnik" <yo****@comcast.netwrote in message news:11*********************@b75g2000hsg.googlegro ups.com...
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.

On Mar 14, 11:22 am, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @
everywhere dot comwrote:
>Pages can use, or not use, any or all assemblies.

Mar 14 '07 #4
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;
}
}
}
On Mar 14, 2:07 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot comwrote:
without seeing examplehttp://localhost/BaseApp/CustomPage.aspxcode I can offer no assistance.
Mar 14 '07 #5
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
"Yofnik" <yo****@comcast.netwrote in message news:11*********************@e1g2000hsg.googlegrou ps.com...
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;
}
}
}
On Mar 14, 2:07 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot comwrote:
>without seeing examplehttp://localhost/BaseApp/CustomPage.aspxcode I can offer no assistance.

Mar 14 '07 #6
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.

On Mar 14, 6:11 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot comwrote:
I don't see any errors, but I don't do C#.
>
Mar 14 '07 #7


you need to register the assembly in the page
http://www.asp101.com/articles/misc/...ol/default.asp

"Yofnik" <yo****@comcast.netwrote in message news:11*********************@o5g2000hsb.googlegrou ps.com...
>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.

On Mar 14, 6:11 pm, "Jon Paal [MSMD]" <Jon[ nospam ]Paal @ everywhere
dot comwrote:
> I don't see any errors, but I don't do C#.
>>

Mar 14 '07 #8
I have solved my problem. The Assembly page directive is what I was
looking for.

http://msdn2.microsoft.com/en-us/library/d864zc1k.aspx

Mar 15 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: nospam | last post by:
I just read on Slash Dot about partial types. Now, is it possible to have a code behind split over two pages but still referencing the same .aspx file??? If so, that would be really nice as...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
4
by: Milsnips | last post by:
hi there, Can someone help me out with some example code (VB.NET) here that i need: i would like to programatically check my ASP.NET web application and return a list of all the ASPX and ASCX...
6
by: antonyliu2002 | last post by:
I am using ASP.NET 1.1. In my web application, multiple pages will be using the same functions. I am wondering if I can just pick out the shared code and save it in a separate file and then...
10
by: eswanson | last post by:
I have broken up my web site into smaller web site projects. When I look at the precompiled files, it always has the virtual directory in them ie: <preserve resultType="3"...
3
by: Claudio Pacciarini | last post by:
Hi everyone, I have a question about .NET code sharing and reuse, and also about application design best practices / guidelines. Currently, we have many different .NET projects in source...
1
by: LiveCycle | last post by:
Hi, I'm putting together a project that uses ASP.NET in VS2005. It uses a single master page that is responsible for most of the heavy lifting. About 90% of the 200 pages have the same...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.