How to make use of Partial Class Files

Coreysan 1,651 Reputation points

I hope this is simple! When I use Visual Studio, I can create separate files of the codebehind file (in my case, Default.aspx.cs)., all based on the "partial" keyword.
But when I set up everything in a typical IIS environment, I don't know how to get the aspx file to "see" those separate files.

Can this be done? If so, how do you do it?

Thank you in advance!

Internet Information Services
A set of technologies in the .NET Framework for building web applications and XML web services.
3,318 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sam Wu-MSFT 7,046 Reputation points Microsoft Vendor

    Hi @Coreysan

    When you deploy .aspx pages, if their associated code-behind class files are precompiled, you only have to deploy the assembly to the Bin folder of the application. You do not have to deploy the actual code-behind class files with the application.

    When you deploy .aspx pages, if their associated code-behind class files are not precompiled, you must deploy the code-behind class files with the application. Additionally, you must add the Src attribute to the @ Page directive because the class file must be available when it is compiled on demand.

    More information about code-behind class file you can refer to this link: code-behind-class-files.

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Coreysan 1,651 Reputation points

    Yes - that's what I'm doing now. I wanted to know if I can separate them out, however.
    If it's a problem, or ASP.NET is not built for that as I've described, that would be helpful to know as well.

    Can it be done?