Server Error in '/' Application.

Index was outside the bounds of the array.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 39:   public bool IsMacOS(string userAgent)
Line 40:   {
Line 41:     var osInfo = userAgent.Split(new Char[] { '(', ')' })[1];
Line 42:     return osInfo.Contains("Mac_PowerPC") || osInfo.Contains("Macintosh");
Line 43:   }

Source File: c:\inetpub\websites\www.watermark-image.com\default.aspx.cs    Line: 41

Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   _Default.IsMacOS(String userAgent) in c:\inetpub\websites\www.watermark-image.com\default.aspx.cs:41
   _Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\websites\www.watermark-image.com\default.aspx.cs:30
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4087.0