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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:55:08+00:00 2026-06-07T22:55:08+00:00

I have ASP.net website. In App_Code folder I have class that has extension methods.

  • 0

I have ASP.net website. In App_Code folder I have class that has extension methods. When running this site from visual studio, everything works. However on my IIS 7 server, i received the following error:

CS1061: ‘System.Data.SqlClient.SqlDataReader’ does not contain a definition for ‘SafeGetString’ and no extension method ‘SafeGetString’ accepting a first argument of type ‘System.Data.SqlClient.SqlDataReader’ could be found (are you missing a using directive or an assembly reference?)

But the file containing this extention methods is in App_Code folder. Am I missing something important?

ExtentionMethods Class:

public static class ExtentionMethods
{
    public static string SafeGetString(this SqlDataReader reader, int colIndex)
    {
        if (!reader.IsDBNull(colIndex))
            return reader.GetString(colIndex);
        return "NULL VALUE";
    }

    public static int SafeGetInt32(this SqlDataReader reader, int colIndex)
    {
        if (!reader.IsDBNull(colIndex))
            return reader.GetInt32(colIndex);
        return -1;
    }

    public static DateTime SafeGetDateTime(this SqlDataReader reader, int colIndex)
    {
        if (!reader.IsDBNull(colIndex))
        {
            try
            {
            }
            catch
            {
                return new DateTime(1800, 1, 1);
            }
        }
        return new DateTime(1800, 1, 1);
    }
}
  • 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-07T22:55:09+00:00Added an answer on June 7, 2026 at 10:55 pm

    Thanks to @AnthonyWJones: How come classes in subfolders in my App_Code folder are not being found correctly?

    You need to add codeSubDirectories to your compilation element in web.config

    <configuration>
        <system.web>
          <compilation>
             <codeSubDirectories>
               <add directoryName="Extensions"/>
             </codeSubDirectories>
          </compilation>
       </system.web>
    </configuration>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an asp.net website http://www.site.com . This web app is also running on
I have several class files in App_Code in an ASP.net website running in Microsoft
I have an ASP.NET web site where i am having App_code folder in which
I have created an asp.net website, with the accompanying app_code folder. In the same
I have a legacy ASP.NET/VB.NET WebSite. There several App_Code modules/code files that use types
I have an ASP.NET website project that until recent had all code in App_Code
Let's say I have a class (MyClass.cs) in App_Code (using a ASP.NET web site,
I have a ASP.NET website deployed to IIS with a couple of ashx that
I have an asp.net 4.0 web site that generates email alerts based on several
In a dynamically compiled ASP.NET Website project, can the assembly for the App_Code folder

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.