app_code里我建立了一个限制字数的类stringLimitLength.cs
但在页面的aspx.cs中应用这个类时this.MetaDescription = stringLimitLength.limitLength(data.Single().newsContent, 100);    stringLimitLength提示上下文不存在,using命名空间,就提示app_code不存在,不知道如何解释,望高手赐教……

解决方案 »

  1.   

    http://vishaljoshi.blogspot.com/2009/07/appcode-folder-doesnt-work-with-web.html
      

  2.   

    public class stringLimitLength
        {
            public static string limitLength(string s, int sLength)
            {
                if (s.Length <= sLength)
                {
                    return s;
                }
                else
                {
                    string resultString = s.Substring(0, sLength);
                    return resultString + "…";
                }
            }
        }
      

  3.   

    本帖最后由 net_lover 于 2011-07-08 11:27:39 编辑