Gateway
From Visual WebGui Wiki
| This article missing it's contents and needs writing. Please help contributing to this wiki and add contents. |
Contents |
Gateways and ResourceHandles
Resources such as images, documents etc. are normally static.
They need to be specifically requested for by the client browser.
When the client requests a resource, the request reaches the server and it finds the resource. It then sends it back to the client in a dedicated response.
A Gateway is simply a way to have the request to the server, reach a specific .NET code section inside your application in server-side, that will dynamically generate the content that will be returned in a response to the client.
In the Gateway server code, you can do anything you need and also retrieve or generate the contents of the response.
The Gateway can set the ContentDisposition that determines if the content is to be opened to be viewed inside the page or separately, to be saved, for example.
See Also
Gateway
GatewayReference
ResourceHandle
ImageResourceHandle
IconResourceHandle
AssemblyResourceHandle
Forum threads
- Using AssemblyResourceHandle to get an embedded image from a UserControl
- Getting resource from an assembly
- Getting js resource from an assembly with the help of Red-Gate-Reflector
- Getting js resources from a library
- Getting skin resources from Gizmox.WebGUI.Forms - 6.3 and earlier
- Getting skin resources from skins (themes) - 6.4 and later
Code samples
DatabaseResourceHandle
StaticGatewayResourceHandle
Static Gateways are different from regular (component) gateways as the Static Gateway's absolute Url is known at design time while the absolute Url of (component) gateways is not known until runtime and their Url is based on the Id of the component they are implemented on.
Tips & Tricks
Code Samples
- Basic use of StaticGatewayResourceHandle and IStaticGateway
- Using Static Gateway to load custom CSS for custom font
Forum threads
- Using Static gateway within your Visual WebGui application from an external source
- Using Static gateway to feed iCal feeds to an external application
See also
References
Forum threads
- See Code Samples section below for new DownloadGateway
- Using a Gateway with a FileStream instead of File
- FileDownloadGateway + Updates required to implement IGatewayComponent (instead of obsolete IGatewayControl)
- Determine MIME type using registry lookup (thread)
- Downloading multiple files by Zipping them and download a single file
- Downloading files via UNC path using the Link.Download interface and helper functions
- Discussions on IE blocking of downloads initiated with serverside code
- Dynamically loading images stored on fileserver (DynamicStreamResourceHandle) - remember to add cleanup code
- Download file either via gateway or custom HttpHandler
- Download that doesn't start immediately as processing will take place first - notifying the user
- Download via JavaScript with check for validity first via Ajax call
- Handling Unicode filenames
- How to show images (using Gateway) included in your application as a component resource, like within the .resx file of a form
Videos
Issues
Code samples
- Gauge code-snippet
- Download gateway - simplified file downloads
Sample gateway listing folders on left and showing their contents on right
- File Download Control and Gateway
- Updates required to implement IGatewayComponent (instead of obsolete IGatewayControl)
- Sample C# project correcting code in thread (Stream Length and IGatewayComponent included)
- Custom Visual WebGui URL component at Geniuscode.net
- Basic use of StaticGatewayResourceHandle
- MSCharts .NET Gantt charts and printing with iTextSharp
- Displaying VWG forms, ASP.Net pages and resources from a Class Library or a diffrent assembly
- Implenting gateway to download from a remote Url (demonstrates Gateway parameters, WebRequest and more) - see discussions here.
- Static Gateway feeding custom CSS in a Theme override
Other references
- MIME types and the Web (Multipart Internet Mail Extensions)
- Another more extended MIME types list
- A few methods for determining MIME type in code
- Determine MIME type using registry lookup
- Forcing the download dialog in cases where it doesn't show
- Long discussion on downloading and the download dialog with lot of useful info
- Preventing IE8's information bar blocking of downloads not possible with server-side controls (workaround suggested using client side code)
- Web Caching tutorial
- Prevent caching by attaching random query strings to the address
- Setting Content-Length in response header may be necessary for some gateways
- Downloading unicode filenames
