Server Error in '/' Application.

Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.

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.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.

Source Error:


Line 48: 
Line 49:         Response.ContentType = myRow("ContentType2").ToString()
Line 50:         Response.BinaryWrite(CType(myRow("FileData2"), Byte()))
Line 51:         'Response.OutputStream.Write(CType(myRow("FileData"), Byte()), 0, CInt(myRow("FileSize")))
Line 52: 

Source File: D:\Websites\ANSN\wwwroot\Common\Topics\OpenTopic2.aspx.vb    Line: 50

Stack Trace:


[InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.]
   Open.Page_Load(Object sender, EventArgs e) in D:\Websites\ANSN\wwwroot\Common\Topics\OpenTopic2.aspx.vb:50
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


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