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

  • SEARCH
  • Home
  • 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 705119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:01:04+00:00 2026-05-14T04:01:04+00:00

Assuming server control of type A has a protected member M , then we

  • 0

Assuming server control of type A has a protected member M, then we are also able to access A.M via declaring control tag A on some aspx page:

<asp:A runat=”server” M=”someValue” … />

But isn’t one of the rules in C# that protected members of class A can only be accessed from A and from classes derived from A? So doesn’t the ability to access member A.M via <asp:A M=”someValue” … /> syntax violate this rule, since we are basically accessing A.M from a class ( which is automatically generated aspx class ) not derived from A?!

  • 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-05-14T04:01:04+00:00Added an answer on May 14, 2026 at 4:01 am

    Your markup cannot touch a protected property. I just tested this:

    <cc1:ServerControl1 ID="ServerControl11" runat="server" Text="Text Set"
         ProtectedText="foo" />
    
    protected string ProtectedText { get; set; }
    
    protected override void RenderContents(HtmlTextWriter output)
    {
        output.Write(Text);
        output.Write(ProtectedText);
    }
    

    This does not display “foo”. The property is never modified.

    If you set the page to Debug=”true”:

    <%@ Page Language="C#" ... Debug="true" %>
    

    then the C# files that ASP.NET turns your markup into will be left on disk under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files. It will take some hunting to find the right directory, but here’s what I saw for that markup:

    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    private global::ServerControl1.ServerControl1 @__BuildControlServerControl11() {
        global::ServerControl1.ServerControl1 @__ctrl;
    
        #line 15 "C:\Documents and Settings\jsaunder\My Documents\Visual Studio 2008\Projects\SOSoln\WebApplication1\Default.aspx"
        @__ctrl = new global::ServerControl1.ServerControl1();
    
        #line default
        #line hidden
        this.ServerControl11 = @__ctrl;
        @__ctrl.ApplyStyleSheetSkin(this);
    
        #line 15 "C:\Documents and Settings\jsaunder\My Documents\Visual Studio 2008\Projects\SOSoln\WebApplication1\Default.aspx"
        @__ctrl.ID = "ServerControl11";
    
        #line default
        #line hidden
    
        #line 15 "C:\Documents and Settings\jsaunder\My Documents\Visual Studio 2008\Projects\SOSoln\WebApplication1\Default.aspx"
        @__ctrl.Text = "Text Set";
    
        #line default
        #line hidden
    
        #line 15 "C:\Documents and Settings\jsaunder\My Documents\Visual Studio 2008\Projects\SOSoln\WebApplication1\Default.aspx"
        ((System.Web.UI.IAttributeAccessor)(@__ctrl)).SetAttribute("ProtectedText", "foo");
    
        #line default
        #line hidden
        return @__ctrl;
    }
    

    Note what happened to my “foo”.

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

Sidebar

Related Questions

I have a repeater control with some html controls being populated from some server
In SQL Server assuming one has columns that need to have the same data
H​i. I would like to know the address of my user's Exchange server (assuming
Assuming a JavaScript-based single-page application is returned by the server on the initial request.
Assuming you have only the URL to a file (hosted on the same server
What would be the most sensible choice for building a socket server application, assuming
I am missing this DLL reference in c:\program files\SQL Server\90\Tools\Binn. I'm assuming that this
Problem We have a server over which we have FULL control We have a
Websockets were designed for fast bi-directional communication in the browser. Assuming you have control
I'm looking to hear some best practices... Assuming a web application that interacts with

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.