Sree
Sree

Reputation: 584

Unable to cast object of type 'masterpage' to type 'master'

Im getting this error, very rare cases, not able to trace where is wrong going? Error Msg: "Unable to cast object of type 'ASP.femaster_master' to type 'FEMaster'."

The same page happens to work fine when reupload via FTP, looks strage

Please do help on this.

Upvotes: 4

Views: 3404

Answers (2)

Adam
Adam

Reputation: 411

This bug started when I upgraded my development machine.

The fix is stupid...but the problem went away...Simply wrap it in a try catch block. I had it in a property.

Never seen it again.

Private Function MyMasterPage() As SalesMasterPage
    Try
        Return CType(Page.Master, SalesMasterPage)
    Catch ex As Exception
        'log error
    End Try
End Function

Upvotes: 0

Constanta
Constanta

Reputation: 399

If you have a masterpage called femaster_master try to exclude this one from the project you should be able to see where it is (incorrectly) referenced.

Upvotes: 1

Related Questions