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 6239571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:24:54+00:00 2026-05-24T11:24:54+00:00

There are similar posts here. I just want to clarify something. I implemented this

  • 0

There are similar posts here. I just want to clarify something. I implemented this in a test project. I created two pages page1.aspx and page.aspx are copies of each other except names. I configured them so that they use the same backend coding file.

page1.axpx -> page.aspx.cs
page2.aspx -> (above code)

My question is,

  1. is it it a good idea to avoid extra code and enhance maintenance?

  2. While everyting works in test project above. In my actual project, I get this very common error

The name ‘xxxx’ does not exist in the current context asp

The code will not compile because of the above error. If I run the application from the browser, it does work (or seems to be). My question is, why I am not getting this error in one application and not the other. This issue has been fixed now. But want to why I get this error in the first place and then playing with it here and there, the error disappears.

I believe this really is a Microsoft bug. How? I explain it here.

Page1.aspx.cs is really using Page.aspx page and not page1.aspx controls. The intellisence show only Page1.aspx controls (if u add control to page2, it wont be shown in intellesense, if you add it to Page1, it will be shown). Since the controls on both the pages are exactly the same (including names and IDs), they miraculously work. Sometimes the compiler don’t like it and will give you error (for no apparent reasons). Microsoft should address these issues more elegantly and not throw it on us.

So it is solved for me but can anyone explain this mysterious behavior.

  • 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-24T11:24:55+00:00Added an answer on May 24, 2026 at 11:24 am

    Not truly supported by Microsoft

    I discussed this with Microsoft and here is what I got from them.

    After further investigation, here are the results. Due to the manner in which Intellisense works, we cannot support Intellisense for scenarios involving a shared code behind on the aspx.cs files. There are two different approaches that one can take to deal with this scenario. The option supported in VS is using either AppCode or UserControll for the common code elements and then calling those methods to achieve a common code base. The second option involves using the CodeBehind in the manner that you are currently using it (without Intellisense), and assuming that the code is correct with respect to both design pages, the code should compile correctly since it is an ASP.NET supported scenario. Thank you for your feedback.

    So here what that means

    1. Intellisense will not work with both the pages, but only with one page
    2. your code will compile only if both the controls are on both the pages!

    This really is against the idea of having a shared codeBehind file. My scenario will most likely be two slight different pages which uses same code behind. But for Microsoft, two slightly different pages, can not use the same codebehind file

    Ideal Scenarios should be

    1. Intellisense should pick controls in both the pages
    2. Code should compile if the the control that is accessed is present in either of the two pages.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C# you can use verbatim strings like this: @\\server\share\file.txt Is there something similar
Yes I know there has been similar posts to this however after looking through
I know there are similar, more complex posts around, but I just can't get
I see from reading other posts on this site, there a similar solutions to
Is there something similar to sprintf() in C#? I would for instance like to
There is this option available in Visual Studio 2008. Is there a similar option
Hey there, I have read the few posts here on when/how to use the
So I know there have been a number of similar posts, but I think
New Rails programmer here. There is probably a pretty simple solution to this, but
I've found a couple similar posts regarding this same problem, but none of the

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.