Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inheritance problem

Status
Not open for further replies.

wawalter

Programmer
Aug 2, 2001
125
US
Hello,

I am trying to have my web page inherit from another page in .Net 2.0. It usually works fine, but every once in a while some or all of the child pages return this error:

The type or namespace name 'NETBasePage' could not be found
(are you missing a using directive or an assembly reference?)

If I check everything back into Source Safe and check it out again it will work fine for a while and then I will start getting the error again.

This is what my code looks like:
Code:
public partial class MailerEditNET_ProdCat : NETBasePage

and here is the base class:
Code:
public partial class NETBasePage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    #region Deserialize the Mailer class
    protected Mailer DeserializeMailer()
    {
        HtmlInputHidden hid = new HtmlInputHidden();

        Page callingpage = (Page)Context.Handler;
        hid = (HtmlInputHidden)callingpage.FindControl("hdnMailer");
        string mailer = hid.Value;

        if (mailer.Length > 0)
        {
            byte[] normalisedForm;
            normalisedForm = Convert.FromBase64String(mailer);

            if (normalisedForm.Length > 0)
            {
                BinaryFormatter serializer = new BinaryFormatter();
                MemoryStream ms = new MemoryStream(normalisedForm);
                return (Mailer)serializer.Deserialize(ms);
            }
        }

        return null;
    }
    #endregion

    #region Serialize the Mailer class
    protected string SerializeMailer(Mailer mailer)
    {
        IFormatter formatter = new BinaryFormatter();
        MemoryStream str = new MemoryStream();
        formatter.Serialize(str, mailer);
        string formSafe = Convert.ToBase64String(str.ToArray());

        return formSafe;
    }
    #endregion

    #region Check to see if Mailer class has been serialized
    protected bool CheckSerialization()
    {
        HtmlInputHidden hid = new HtmlInputHidden();

        Page callingpage = (Page)Context.Handler;
        hid = (HtmlInputHidden)callingpage.FindControl("hdnMailer");
        string mailer = hid.Value;

        if (mailer.Length > 0)
            return true;
        else
            return false;

    }
    #endregion

Thanks for any help,
Bill
 
Could what you are trying to achieve not be done with Master Pages rather than Inheritance as that would seem a more logical method?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
In case anyone is having a similar problem, I think I found the solution.

I added
Code:
<%@ Reference Page="NETBasePage.aspx" %>
to the top of all my .aspx pages that inherit from NETBasePage.

Since I did that all the current errors, that I previously fixed by checking in and out of source safe, went away and I haven't had any new errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top