Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:17:24+00:00 2026-06-01T15:17:24+00:00

I’m having this issue when trying to use an ASPX page from a referenced

  • 0

I’m having this issue when trying to use an ASPX page from a referenced assembly. This page consists of a content page and its master page. The exception only raises when any of the content page webcontrols are accessed from another web project, but that doesn’t happen when that page is visited from the same project it belongs to.

At first, this pages were supposed to be regular ASPX pages, and then they worked great (ie this exception didn’t happen), but our higher-ups decided to wrap them into MasterPages for some reusability sake or something (which is kinda odd since this ASPX pages are autogenerated).

So, we got into this trouble now : /

EDIT:
I’m adding some code to help you to help me 🙂

Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs"
Inherits="WebApplicationTemplate.MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <asp:ContentPlaceHolder ID="headPlaceHolder" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form" runat="server">
        <asp:ContentPlaceHolder ID="formPlaceHolder" runat="server">
        </asp:ContentPlaceHolder>
    </form>
</body>
</html>

Content Page:

<%@ MasterType VirtualPath="~/MasterPage.Master" %>

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="TestPage.aspx.cs" Inherits="WebApplicationTemplate.TestPage" %>

<asp:Content ID="headContent" ContentPlaceHolderID="headPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="formContent" ContentPlaceHolderID="formPlaceHolder" runat="server">
    <asp:TextBox ID="id1" runat="server" Text="Text" MaxLength="40" Style="top: 100;
        left: 100; width: 100; height: 100; position: absolute;" />
</asp:Content>

Function that raises the exception in the content page code behind:

public void Foo()
{
id1.Text = "something"; //Object reference not set to an instance of an object.
}

As I said before, I only got this problem when I access this page from another project through a referenced assembly.
I don’t know if I have to configure something in any web.config, whether in the Master page project or the one which references the assembly of the former project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:17:25+00:00Added an answer on June 1, 2026 at 3:17 pm

    Problem solved.

    The first line on the Content Page messed it up, so this is how it looks now:

        <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
        CodeBehind="TestPage.aspx.cs" Inherits="WebApplicationTemplate.TestPage" %>
    <asp:Content ID="headContent" ContentPlaceHolderID="headPlaceHolder" runat="server">
    </asp:Content>
    <asp:Content ID="formContent" ContentPlaceHolderID="formPlaceHolder" runat="server">
        <asp:TextBox ID="id1" runat="server" Text="Text" MaxLength="40" Style="top: 100;
            left: 100; width: 100; height: 100; position: absolute;" />
    </asp:Content>
    

    So after removing the <%@ MasterType VirtualPath="~/MasterPage.Master" %> line, the problem was solved, although now we have to cast the Page.Master property if one wants to access to its fields, properties, controls, etc… from the ContentPage, cause by removing the aforementioned line, we don’t know anymore which MasterPage class are we refering to.

    Something like this:

        MasterPage MP;
    
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            //Setting the master page
            MP = ((WebApplicationTemplate.MasterPage)Master);
        }
    
        protected void Foo()
        {
            //Accessing a MasterPage control
            MP.Bar.Visible = false;
        }
    

    And well, this is it. Can’t guess how this solves my problem, but it does. I’ll be very glad if someone could shed some light upon this and satisfy my curiosity.
    It’s very unlikely but, hope anyone find this usefull if someone happen to get stuck with this very problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.