Search KB Filter article types
Displaying VWG forms, ASP.Net pages and resources from a Class Library or a diffrent assembly
Categories: Graphics & Pictures, Dynamic Resources (Gateways)
Tags: Architects, Developers, Gateway, Resource Handlers, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
Revision: 1
Posted: 02/Jan/2009
Updated: 02/Jan/2009
Status: Publish
Types: Code

Code updated on April 5th 2009 to include a support for deployment to IIS

Code updated on March 11th 2009 to include a demonstration on loading image resources from a different assembly


This snippet was created to demonstrate how to handle two sepecific scenarios:

1.
If you want to display ASP.NET pages in a section of a VWG Form, but the pages are located in a different assembly, the best way to do that would be to use ASP.NET virtual paths, as used in the attached application.

The reason for that is that giving a VWG HtmlBox or AspPageBox control a path to a file, would create a separate new request by client-side to that page. The ASP.NET runtime that VWG runs over only knows of the application project as a path for displayable pages. Referenced Class-Library projects are not searched for contained pages.

2.
If you want to display VWG Forms in a section of an ASP.NET Page, but these Forms are located in a different assembly, the only way to do that would be to add XML elements for these Forms to the Web.config's "Applications" section as additional application starting points (MainForms). In these new XML elements you would need to specify the full assembly name and the namespace of the Form of every such element.

The reason for that is the VWG Forms are completely virtual. There does not have to be an actual class behind a call to for example "Form1.wgx". If the class exists though, it doesn't need to be in any specific assembly, as long as the assembly it is in is referenced be the application project. The Web.config is the place where we specify all the available starting points (MainForms) for the VWG application.

The structure of the application:

Basically this application has a VWG Form that internally displays an ASP.NET page that is located in a different assembly.
That page then internally displays a VWG Form that is located in another different assembly.

Further details:
In the initial VWG Form there is an HtmlBox control that on Form Load event takes a virtual path to an ASP.NET page that is located in a different assembly.

In that second assembly, there is a System.Web.Hosting.VirtualPathProvider that on the Load of the VWG Form Load, is registered to the current System.Web.Hosting.HostingEnvironment. It is used to direct requests to virtual paths of the application accordingly, into the second assembly.

 

* Pay attention to the fact that the *.aspx page that is loaded through the virtual path is set to be an Embedded Resource. This is a must.

 

Have fun...

Note: Codes are submitted as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Terms of Agreement:
By using this code, you agree to the following terms...

1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3. You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


About the author

Related Articles

Graphics & Pictures  
Title Update Author
This code snippet demonstrates creation of a custom control with new client side events which are handled on the client by the custom control's client's script.
Tags: Developers, Events, Gateway, JavaScript, 1. Beginner, 2. Intermediate, Customization, Pre v6.3, v6.3, 3. Advanced, v6.4 and Later
28/Dec/2010    2010/12/28
Tags: Architects, Developers, Gateway, Resource Handlers, 1. Beginner, 2. Intermediate, Pre v6.3, v6.3, v6.4 and Later, 3. Advanced
12/Jan/2007    2007/01/12
This article demonstrates the use of an active Gauge in a Visual WebGui application.
Tags: Developers, 1. Beginner, 2. Intermediate, 3. Advanced, v6.3, v6.4 and Later
12/Jan/2009    2009/01/12
Tags: Developers, Gateway, 1. Beginner, 2. Intermediate, 3. Advanced, v6.3, v6.4 and Later
17/Nov/2010    2010/11/17
Tags: Architects, Developers, Gateway, Resource Handlers, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
04/Dec/2010    2010/12/04
Tags: Architects, Developers, Gateway, Resource Handlers, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
28/Oct/2010    2010/10/28
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS