Html – How to embed an ASP.NET Web Site (or Web Application) into another

asp.nethtml-framesvisual-studio-2008

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 utility works is not my concern right now. However, the utility eventually needs to end up embedded in someone else's web site, either just as a URL to the page with my code, or embedded (say, as an HTML frame or an iframe). To figure out the basics of this, I coded up two very simple ASP.NET web sites, a "parent" which contains the frameset, and a "child" which I am trying to put into one of the frames.

The parent's "Default.aspx" HTML code is basically this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Parent Site Test 1</title>
</head>

<frameset cols="300,*">
    <frame name="outer" src="parent.aspx" noresize></frame>
    <frame name="inner" src="[what do I put here?]"</frame>
</frameset>

</html>

The "parent.aspx" page has only the most basic HTML in it:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        I am the parent web form.
    </div>
    </form>
</body>
</html>

The child web site (as I have it now) lives in a separate VS2008 solution, for the purposes of this exercise, because I am trying to reproduce the conditions in which someone else's web site has to reference my calibration web page/site/thing. I was originally thinking there would be some way to package the entire child into a single DLL, and then there would be some way to tell the parent to use that DLL as the source for the child frame. This comes from my experience in the Java world – using JBoss and J2EE, this would be easily solved because the child would just be deployed as another EAR file.

Being completely inexperienced with VS2008 and ASP.NET, I spent quite a few hours on Google over the past few days trying to find an answer, to no avail.

  • Is what I'm trying to do reasonable; is it the right way to think about solving the problem?

  • Can I deploy the child as a fairly independent and self-contained web site (or web application… I'm still unclear on the differences) by somehow packaging it into a single DLL? If yes, then how do I actually create this DLL from my web site/application in VS2008, and how do I then reference it in the parent web site?

  • If I am totally off track here, how can I create this parent/child combination in some other way? The child (really, the calibration utility I will eventually write) does need to be in ASP.NET (with C#) but I don't have any control over the parent site, since it's someone else's code, and they just want to be able to drop in my utility.

Thanks for the help! The more specific you can be, the better. I am very new to ASP.NET and Visual Studio, though I do have plenty of experience programming in other languages and IDEs.

Best Answer

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

Related Topic