Example #1
0
 public Idaho.Network.IpAddress GetIpAddress(int i)
 {
     if (_reader.IsDBNull(i))
     {
         return(null);
     }
     else
     {
         IpAddress ip    = null;
         int       value = _reader.GetInt32(i);
         try {
             ip = new Idaho.Network.IpAddress(value);
         } catch (System.Exception e) {
             Idaho.Exception.Log(e, Exception.Types.InvalidArgument,
                                 "Attempting to parse " + value.ToString());
         }
         return(ip);
     }
 }
Example #2
0
        /// <summary>
        /// Load values used to supplement exception information
        /// </summary>
        /// <param name="redirect">Should user be redirected to an error page</param>
        private Exception(System.Exception ex, bool redirect, string note, Types type)
        {
            _message     = ex.Message;
            _stack       = ex.StackTrace;
            _source      = ex.Source;
            _type        = type;
            _redirect    = redirect;
            _note        = note;
            _process     = AppDomain.CurrentDomain.FriendlyName;
            _machineName = Environment.MachineName;
            _sendEmail   = (_emailTo != null);

            if (ex.InnerException != null)
            {
                _inner = new Exception(ex.InnerException, redirect, note, type);
            }

            if (HttpContext.Current != null)
            {
                Web.Profile profile = Web.Profile.Load(HttpContext.Current);
                if (profile != null)
                {
                    _user = profile.User;
                }
                _browser     = HttpContext.Current.Request.UserAgent;
                _cookies     = this.CookieString();
                _userIP      = Idaho.Network.IpAddress.Client;
                _pageName    = HttpContext.Current.Request.Url.LocalPath;
                _pageName    = _pageName.Substring(_pageName.LastIndexOf("/") + 1);
                _queryString = HttpUtility.UrlDecode(HttpContext.Current.Request.Url.Query).TrimStart('?');
            }
            else
            {
                _browser  = "[Server]";
                _userIP   = Idaho.Network.IpAddress.Host;
                _pageName = _source;
            }
        }