Click here to Skip to main content
15,892,480 members
Articles / Programming Languages / XML

Using InsomniaServer to Build a Web-interface for your Application

Rate me:
Please Sign up or sign in to vote.
4.80/5 (11 votes)
15 Jul 2011CPOL3 min read 83.5K   1.2K   41  
InsomniaServer enables you to add a fully-featured, customizable webserver to your projects. See how it works.
//All code is copyright � 2007, InsomniaSoftware | Manuel Then, All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace InsomniaSoftware.Server.Sources
{
    /// <summary>
    /// Static class which contains the GetSource callback for an internal redirection
    /// </summary>
    public static class InternalRedirectSource
    {
        /// <summary>
        /// Gets a source which redirects the request to another server-internal location
        /// </summary>
        /// <param name="subPath">/</param>
        /// <param name="request">Request handle</param>
        /// <param name="redirectToLocation">Location to which the request is to be redirected</param>
        /// <param name="source">Source output</param>
        /// <returns>ObjectType of the redirected object</returns>
        public static ObjectType GetSource(string subPath, HttpRequest request, object redirectToLocation, out Source source)
        {
            FSNode tempNode = null;
            Source redirectToSource = request.server.fileSystem.root.GetSource(request, (string)redirectToLocation, ref tempNode);
            if (redirectToSource != null)
            {
                source = redirectToSource;
                return ObjectType.File;
            }
            else
            {
                source = null;
                return ObjectType.NotFound;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Germany Germany
I was born in 1987. Unfortunately too late to experience the real rise of the PC. But fortunately late enough to enjoy things like MS's .net during my school time Wink | ;)

From the time when some relative taught me a little BASIC under MS DOS, I loved to tell computers what to do - even though my real start in programming was around the age of 16.

At the moment, I am studying Software Engineering at University of Augsburg, always hoping to find time to design and program.
Besides, I like meeting friends, spent time with my girlfriend and enjoy life Smile | :)

Comments and Discussions