internal override void CheckObjectTagScope(ref ObjectTagScope scope)
 {
     if (scope == ObjectTagScope.Default)
     {
         scope = ObjectTagScope.AppInstance;
     }
     if (scope == ObjectTagScope.Page)
     {
         throw new HttpException(System.Web.SR.GetString("Page_scope_in_global_asax"));
     }
 }
 internal override void CheckObjectTagScope(ref ObjectTagScope scope)
 {
     if (scope == ObjectTagScope.Default)
     {
         scope = ObjectTagScope.AppInstance;
     }
     if (scope == ObjectTagScope.Page)
     {
         throw new HttpException(System.Web.SR.GetString("Page_scope_in_global_asax"));
     }
 }
    internal override void CheckObjectTagScope(ref ObjectTagScope scope) {

        // Map the default scope to AppInstance
        if (scope == ObjectTagScope.Default)
            scope = ObjectTagScope.AppInstance;

        // Check for invalid scopes
        if (scope == ObjectTagScope.Page) {
            throw new HttpException(
                SR.GetString(SR.Page_scope_in_global_asax));
        }
    }
        internal override void CheckObjectTagScope(ref ObjectTagScope scope)
        {
            // Map the default scope to AppInstance
            if (scope == ObjectTagScope.Default)
            {
                scope = ObjectTagScope.AppInstance;
            }

            // Check for invalid scopes
            if (scope == ObjectTagScope.Page)
            {
                throw new HttpException(
                          HttpRuntime.FormatResourceString(SR.Page_scope_in_global_asax));
            }
        }
Example #5
0
    internal virtual void CheckObjectTagScope(ref ObjectTagScope scope) {

        // Map the default scope to Page
        if (scope == ObjectTagScope.Default)
            scope = ObjectTagScope.Page;

        // Check for invalid scopes
        if (scope != ObjectTagScope.Page) {
            throw new HttpException(
                SR.GetString(SR.App_session_only_valid_in_global_asax));
        }
    }
Example #6
0
        public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs)
        {
            if (id == null)
            {
                throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_id"));
            }
            base.ID = id;
            string str = (string)attribs["scope"];

            if (str == null)
            {
                this._scope = ObjectTagScope.Default;
            }
            else if (StringUtil.EqualsIgnoreCase(str, "page"))
            {
                this._scope = ObjectTagScope.Page;
            }
            else if (StringUtil.EqualsIgnoreCase(str, "session"))
            {
                this._scope = ObjectTagScope.Session;
            }
            else if (StringUtil.EqualsIgnoreCase(str, "application"))
            {
                this._scope = ObjectTagScope.Application;
            }
            else
            {
                if (!StringUtil.EqualsIgnoreCase(str, "appinstance"))
                {
                    throw new HttpException(System.Web.SR.GetString("Invalid_scope", new object[] { str }));
                }
                this._scope = ObjectTagScope.AppInstance;
            }
            Util.GetAndRemoveBooleanAttribute(attribs, "latebinding", ref this._fLateBinding);
            string typeName = (string)attribs["class"];

            if (typeName != null)
            {
                this._type = parser.GetType(typeName);
            }
            if (this._type == null)
            {
                typeName = (string)attribs["classid"];
                if (typeName != null)
                {
                    Guid clsid = new Guid(typeName);
                    this._type = Type.GetTypeFromCLSID(clsid);
                    if (this._type == null)
                    {
                        throw new HttpException(System.Web.SR.GetString("Invalid_clsid", new object[] { typeName }));
                    }
                    if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
                    {
                        this._lateBound = true;
                        this._clsid     = typeName;
                    }
                    else
                    {
                        parser.AddTypeDependency(this._type);
                    }
                }
            }
            if (this._type == null)
            {
                typeName = (string)attribs["progid"];
                if (typeName != null)
                {
                    this._type = Type.GetTypeFromProgID(typeName);
                    if (this._type == null)
                    {
                        throw new HttpException(System.Web.SR.GetString("Invalid_progid", new object[] { typeName }));
                    }
                    if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
                    {
                        this._lateBound = true;
                        this._progid    = typeName;
                    }
                    else
                    {
                        parser.AddTypeDependency(this._type);
                    }
                }
            }
            if (this._type == null)
            {
                throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_class_classid_or_progid"));
            }
        }
    private bool _fLateBinding; // Force latebinding when early binding could be done


    /// <internalonly/>
    /// <devdoc>
    /// </devdoc>
    public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
        Type type, string tagName,
        string id, IDictionary attribs) {

        if (id == null) {
            throw new HttpException(
                SR.GetString(SR.Object_tag_must_have_id));
        }

        ID = id;

        // Get the scope attribute of the object tag
        string scope = (string) attribs["scope"];

        // Map it to an ObjectTagScope enum
        if (scope == null)
            _scope = ObjectTagScope.Default;
        else if (StringUtil.EqualsIgnoreCase(scope, "page"))
            _scope = ObjectTagScope.Page;
        else if (StringUtil.EqualsIgnoreCase(scope, "session"))
            _scope = ObjectTagScope.Session;
        else if (StringUtil.EqualsIgnoreCase(scope, "application"))
            _scope = ObjectTagScope.Application;
        else if (StringUtil.EqualsIgnoreCase(scope, "appinstance"))
            _scope = ObjectTagScope.AppInstance;
        else
            throw new HttpException(SR.GetString(SR.Invalid_scope, scope));

        Util.GetAndRemoveBooleanAttribute(attribs, "latebinding",
            ref _fLateBinding);

        string tmp = (string) attribs["class"];

        // Is there a 'class' attribute?
        if (tmp != null) {
            // Get a Type object from the type string
            _type = parser.GetType(tmp);
        }

        // If we don't have a type, check for a classid attribute
        if (_type == null) {
            tmp = (string) attribs["classid"];

            if (tmp != null) {
                // Create a Guid out of it
                Guid clsid = new Guid(tmp);

                // Turn it into a type
                _type = Type.GetTypeFromCLSID(clsid);

                if (_type == null)
                    throw new HttpException(SR.GetString(SR.Invalid_clsid, tmp));

                // 




                if (_fLateBinding || Util.IsLateBoundComClassicType(_type)) {
                    _lateBound = true;
                    _clsid = tmp;
                }
                else {

                    // Add a dependency to the type, so that the user can use it without
                    // having to import it
                    parser.AddTypeDependency(_type);
                }
            }
        }

        // If we don't have a type, check for a progid attribute
        if (_type == null) {
            tmp = (string) attribs["progid"];

            if (tmp != null) {
#if !FEATURE_PAL // FEATURE_PAL does not enable COM
                // Turn it into a type
                _type = Type.GetTypeFromProgID(tmp);
#else // !FEATURE_PAL
                throw new NotImplementedException("ROTORTODO");
#endif // !FEATURE_PAL


                if (_type == null)
                    throw new HttpException(SR.GetString(SR.Invalid_progid, tmp));

                Debug.Trace("Template", "<object> type: " + _type.FullName);

                // 




                if (_fLateBinding || Util.IsLateBoundComClassicType(_type)) {
                    _lateBound = true;
                    _progid = tmp;
                }
                else {

                    // Add a dependency to the type, so that the user can use it without
                    // having to import it
                    parser.AddTypeDependency(_type);
                }
            }
        }

        // If we still don't have a type, fail
        if (_type == null) {
            throw new HttpException(
                SR.GetString(SR.Object_tag_must_have_class_classid_or_progid));
        }
    }
 public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs)
 {
     if (id == null)
     {
         throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_id"));
     }
     base.ID = id;
     string str = (string) attribs["scope"];
     if (str == null)
     {
         this._scope = ObjectTagScope.Default;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "page"))
     {
         this._scope = ObjectTagScope.Page;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "session"))
     {
         this._scope = ObjectTagScope.Session;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "application"))
     {
         this._scope = ObjectTagScope.Application;
     }
     else
     {
         if (!StringUtil.EqualsIgnoreCase(str, "appinstance"))
         {
             throw new HttpException(System.Web.SR.GetString("Invalid_scope", new object[] { str }));
         }
         this._scope = ObjectTagScope.AppInstance;
     }
     Util.GetAndRemoveBooleanAttribute(attribs, "latebinding", ref this._fLateBinding);
     string typeName = (string) attribs["class"];
     if (typeName != null)
     {
         this._type = parser.GetType(typeName);
     }
     if (this._type == null)
     {
         typeName = (string) attribs["classid"];
         if (typeName != null)
         {
             Guid clsid = new Guid(typeName);
             this._type = Type.GetTypeFromCLSID(clsid);
             if (this._type == null)
             {
                 throw new HttpException(System.Web.SR.GetString("Invalid_clsid", new object[] { typeName }));
             }
             if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
             {
                 this._lateBound = true;
                 this._clsid = typeName;
             }
             else
             {
                 parser.AddTypeDependency(this._type);
             }
         }
     }
     if (this._type == null)
     {
         typeName = (string) attribs["progid"];
         if (typeName != null)
         {
             this._type = Type.GetTypeFromProgID(typeName);
             if (this._type == null)
             {
                 throw new HttpException(System.Web.SR.GetString("Invalid_progid", new object[] { typeName }));
             }
             if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
             {
                 this._lateBound = true;
                 this._progid = typeName;
             }
             else
             {
                 parser.AddTypeDependency(this._type);
             }
         }
     }
     if (this._type == null)
     {
         throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_class_classid_or_progid"));
     }
 }
Example #9
0
        private bool _fLateBinding; // Force latebinding when early binding could be done


        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName,
                                  string id, IDictionary attribs)
        {
            if (id == null)
            {
                throw new HttpException(
                          SR.GetString(SR.Object_tag_must_have_id));
            }

            ID = id;

            // Get the scope attribute of the object tag
            string scope = (string)attribs["scope"];

            // Map it to an ObjectTagScope enum
            if (scope == null)
            {
                _scope = ObjectTagScope.Default;
            }
            else if (StringUtil.EqualsIgnoreCase(scope, "page"))
            {
                _scope = ObjectTagScope.Page;
            }
            else if (StringUtil.EqualsIgnoreCase(scope, "session"))
            {
                _scope = ObjectTagScope.Session;
            }
            else if (StringUtil.EqualsIgnoreCase(scope, "application"))
            {
                _scope = ObjectTagScope.Application;
            }
            else if (StringUtil.EqualsIgnoreCase(scope, "appinstance"))
            {
                _scope = ObjectTagScope.AppInstance;
            }
            else
            {
                throw new HttpException(SR.GetString(SR.Invalid_scope, scope));
            }

            Util.GetAndRemoveBooleanAttribute(attribs, "latebinding",
                                              ref _fLateBinding);

            string tmp = (string)attribs["class"];

            // Is there a 'class' attribute?
            if (tmp != null)
            {
                // Get a Type object from the type string
                _type = parser.GetType(tmp);
            }

            // If we don't have a type, check for a classid attribute
            if (_type == null)
            {
                tmp = (string)attribs["classid"];

                if (tmp != null)
                {
                    // Create a Guid out of it
                    Guid clsid = new Guid(tmp);

                    // Turn it into a type
                    _type = Type.GetTypeFromCLSID(clsid);

                    if (_type == null)
                    {
                        throw new HttpException(SR.GetString(SR.Invalid_clsid, tmp));
                    }

                    //



                    if (_fLateBinding || Util.IsLateBoundComClassicType(_type))
                    {
                        _lateBound = true;
                        _clsid     = tmp;
                    }
                    else
                    {
                        // Add a dependency to the type, so that the user can use it without
                        // having to import it
                        parser.AddTypeDependency(_type);
                    }
                }
            }

            // If we don't have a type, check for a progid attribute
            if (_type == null)
            {
                tmp = (string)attribs["progid"];

                if (tmp != null)
                {
#if !FEATURE_PAL // FEATURE_PAL does not enable COM
                    // Turn it into a type
                    _type = Type.GetTypeFromProgID(tmp);
#else // !FEATURE_PAL
                    throw new NotImplementedException("ROTORTODO");
#endif // !FEATURE_PAL


                    if (_type == null)
                    {
                        throw new HttpException(SR.GetString(SR.Invalid_progid, tmp));
                    }

                    Debug.Trace("Template", "<object> type: " + _type.FullName);

                    //



                    if (_fLateBinding || Util.IsLateBoundComClassicType(_type))
                    {
                        _lateBound = true;
                        _progid    = tmp;
                    }
                    else
                    {
                        // Add a dependency to the type, so that the user can use it without
                        // having to import it
                        parser.AddTypeDependency(_type);
                    }
                }
            }

            // If we still don't have a type, fail
            if (_type == null)
            {
                throw new HttpException(
                          SR.GetString(SR.Object_tag_must_have_class_classid_or_progid));
            }
        }
Example #10
0
        private bool _fLateBinding; // Force latebinding when early binding could be done

        /// <include file='doc\ObjectTag.uex' path='docs/doc[@for="ObjectTagBuilder.Init"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
                                  Type type, string tagName,
                                  string id, IDictionary attribs)
        {
            if (id == null)
            {
                throw new HttpException(
                          HttpRuntime.FormatResourceString(SR.Object_tag_must_have_id));
            }

            _id = id;

            // Get the scope attribute of the object tag
            string scope = (string)attribs["scope"];

            // Map it to an ObjectTagScope enum
            if (scope == null)
            {
                _scope = ObjectTagScope.Default;
            }
            else if (string.Compare(scope, "page", true, CultureInfo.InvariantCulture) == 0)
            {
                _scope = ObjectTagScope.Page;
            }
            else if (string.Compare(scope, "session", true, CultureInfo.InvariantCulture) == 0)
            {
                _scope = ObjectTagScope.Session;
            }
            else if (string.Compare(scope, "application", true, CultureInfo.InvariantCulture) == 0)
            {
                _scope = ObjectTagScope.Application;
            }
            else if (string.Compare(scope, "appinstance", true, CultureInfo.InvariantCulture) == 0)
            {
                _scope = ObjectTagScope.AppInstance;
            }
            else
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Invalid_scope, scope));
            }

            Util.GetAndRemoveBooleanAttribute(attribs, "latebinding",
                                              ref _fLateBinding);

            string tmp = (string)attribs["class"];

            // Is there a 'class' attribute?
            if (tmp != null)
            {
                // Get a Type object from the type string
                _type = parser.GetType(tmp);
            }

            // If we don't have a type, check for a classid attribute
            if (_type == null)
            {
                tmp = (string)attribs["classid"];

                if (tmp != null)
                {
                    // Create a Guid out of it
                    Guid clsid = new Guid(tmp);

                    // Turn it into a type
                    _type = Type.GetTypeFromCLSID(clsid);

                    if (_type == null)
                    {
                        throw new HttpException(HttpRuntime.FormatResourceString(SR.Invalid_clsid, tmp));
                    }

                    // REVIEW: Currently, it is still required to use tlbimp and
                    // comreg in order to use a COM DLL.  If this has not
                    // been done, we get an object of type System.__ComObject.
                    // Per ASURT 8737, we will generate a field of type object for this,
                    // and create it at runtime using the progid.
                    if (_fLateBinding || Util.IsLateBoundComClassicType(_type))
                    {
                        _lateBound = true;
                        _clsid     = tmp;
                    }
                    else
                    {
                        // Add a dependency to the type, so that the user can use it without
                        // having to import it
                        parser.AddTypeDependency(_type);
                    }
                }
            }

            // If we don't have a type, check for a progid attribute
            if (_type == null)
            {
                tmp = (string)attribs["progid"];

                if (tmp != null)
                {
                    // Turn it into a type
                    _type = Type.GetTypeFromProgID(tmp);

                    if (_type == null)
                    {
                        throw new HttpException(HttpRuntime.FormatResourceString(SR.Invalid_progid, tmp));
                    }

                    Debug.Trace("Template", "<object> type: " + _type.FullName);

                    // REVIEW: Currently, it is still required to use tlbimp and
                    // comreg in order to use a COM DLL.  If this has not
                    // been done, we get an object of type System.__ComObject.
                    // Per ASURT 8737, we will generate a field of type object for this,
                    // and create it at runtime using the progid.
                    if (_fLateBinding || Util.IsLateBoundComClassicType(_type))
                    {
                        _lateBound = true;
                        _progid    = tmp;
                    }
                    else
                    {
                        // Add a dependency to the type, so that the user can use it without
                        // having to import it
                        parser.AddTypeDependency(_type);
                    }
                }
            }

            // If we still don't have a type, fail
            if (_type == null)
            {
                throw new HttpException(
                          HttpRuntime.FormatResourceString(SR.Object_tag_must_have_class_classid_or_progid));
            }
        }