Page inheritance problem

J

Jon

I have made the following class and want all my pages to inherit from it instead of system.web.ui.page. this works fine, except that now in the designer none of the controls have names and I get an error "Type Abstract" when I do switch to designer mode...

I can't use windows forms auth because we use frames and iframes on the site, and each of them gets redirected to the login page, instead of just the central content frame. If there's a way around that, I won't need to do the checking below...


Any ideas?


Here is the class they inherit from:

Public Class PageAuth
Inherits System.Web.UI.Page

Public Sub New()
AddHandler MyBase.Load, AddressOf Me.PageAuth_Load
End Sub

Private Sub PageAuth_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
AccessCheck()
End Sub

Private Sub AccessCheck()
Dim oTemp As Object

oTemp = Session("UserEmpNo")

If oTemp Is Nothing Then
Response.Redirect("login.aspx?s=NoSession", True)
End If

If CType(oTemp, String) = "" Then
Response.Redirect("login.aspx?s=NoSession", True)
End If
End Sub
End Class
 
J

Jon

I kinda worded this wrong. I understand that inheriting from my class instead of ui.page will cause this problem and there isn't a workaround. I should have asked more specifically about using Forms auth on a site that utilizes frames...

Any ideas on that?


I have made the following class and want all my pages to inherit from it instead of system.web.ui.page. this works fine, except that now in the designer none of the controls have names and I get an error "Type Abstract" when I do switch to designer mode...

I can't use windows forms auth because we use frames and iframes on the site, and each of them gets redirected to the login page, instead of just the central content frame. If there's a way around that, I won't need to do the checking below...


Any ideas?


Here is the class they inherit from:

Public Class PageAuth
Inherits System.Web.UI.Page

Public Sub New()
AddHandler MyBase.Load, AddressOf Me.PageAuth_Load
End Sub

Private Sub PageAuth_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
AccessCheck()
End Sub

Private Sub AccessCheck()
Dim oTemp As Object

oTemp = Session("UserEmpNo")

If oTemp Is Nothing Then
Response.Redirect("login.aspx?s=NoSession", True)
End If

If CType(oTemp, String) = "" Then
Response.Redirect("login.aspx?s=NoSession", True)
End If
End Sub
End Class
 
J

John Saunders

I have made the following class and want all my pages to inherit from it instead of system.web.ui.page. this works fine, except that now in the designer none of the controls have names and I get an error "Type Abstract" when I do switch to designer mode...
The designer does not support page inheritance for web forms, only for Windows Forms. You should not put UI elements on base pages because of this.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top