Skip to content Skip to sidebar Skip to footer

How Do I Embed An ASP.NET Web Site (or Web Application) Into Another?

I have very little experience with ASP.NET and I am doing some self-training before I start writing my first web site/application, which will be a calibration utility. How that uti

Solution 1:

If you know the client also uses ASP.Net, you could build it as a User Control.


Solution 2:

If you have IIS6 or higher, you can run both of the web applications and in your src="[what goes here]" you put the local URL of the child website (maybe http://localhost/ChildTestWebsite/child.aspx). Then when you load up http://localhost/ParentTestWebsite/Default.aspx you should see the frames.

To package it into a single DLL, I believe you have to make it just a user control like Joel said, otherwise you have the DLL + aspx pages.


Solution 3:

What you should do depends on how the interaction between the parent and child is.

If the parent is not going to access any server-side functionality on the child, you can just reference to the absolute http path in the src on the frame tag. You might get security issues in some browsers if you try to access javascript methods and the 2 apps are on diferent web servers, but this is not .NET specific.

If the parent is going to access server side functionality, you need to provide the server side components somewhere in the parent project. This is more complex. I think you have to build all child pages as web controls that is included in a parent aspx page.

1: Build the child project as a webcontrol library of server controls that can be used by the parent. This is best approach conserning deployment. Everything is built into one single dll. The biggest disadvantage to this, is that server controls can only be developed in code. You have no visual designer to help you.

2: Create a Web Application project. In VS2008 you do this by "New Project" and then find the "ASP.NET Web Application" template. This means a web project where all code behind (everything inside the cs files) is build into a single dll. In this scenario, you create user controls (ascx files) that can be used by the parent page. The disanvantage of this is that user controls must be loacted on the runnin web app, so you must copy all ascx files to the deployed location of the parent web site. The dll must also be copied to a bin folder in the parent web site. Here you have the advantage that it is much simpler to design the GUI in VisualStudio. Designing the gui and code behind for ascx user controls are very similar to creating full aspx web pages.


Post a Comment for "How Do I Embed An ASP.NET Web Site (or Web Application) Into Another?"