System.Net.HttpListener.GetContext C# (CSharp) Method

GetContext() public method

public GetContext ( ) : HttpListenerContext
return HttpListenerContext
        public HttpListenerContext GetContext()
        {
            throw new PlatformNotSupportedException();
        }

Usage Example

Esempio n. 1
0
        protected override void StartRun()
        {
            _listener = new HttpListener();
            #if !UNSAFE
            try
            {
            #endif
                _listener.Prefixes.Add("http://*:" + (Settings.Instance.WebServerPort) + "/");
                try
                {
                    _listener.Start();
                }
                catch (HttpListenerException ex)
                {
            #if WINDOWS
                    if (ex.NativeErrorCode == 5)
                    {
                        Log.Fatal(@"TO GET XG UP AND RUNNING YOU MUST RUN 'netsh http add urlacl url=http://*:5556/ user=%USERDOMAIN%\%USERNAME%' AS ADMINISTRATOR");
                    }
            #endif
                    throw;
                }

                var fileLoader = new FileLoader {Salt = Salt};

                while (_allowRunning)
                {
            #if !UNSAFE
                    try
                    {
            #endif
                        var connection = new BrowserConnection
                        {
                            Context = _listener.GetContext(),
                            Servers = Servers,
                            Files = Files,
                            Searches = Searches,
                            Snapshots = Snapshots,
                            FileLoader = fileLoader,
                            Password = Password,
                            Salt = Salt
                        };

                        connection.Start();
            #if !UNSAFE
                    }
                    catch (HttpListenerException)
                    {
                        // this is ok
                    }
            #endif
                }
            #if !UNSAFE
            }
            catch (HttpListenerException)
            {
                // this is ok
            }
            #endif
        }
All Usage Examples Of System.Net.HttpListener::GetContext