Showing posts with label level. Show all posts
Showing posts with label level. Show all posts

Monday, March 26, 2012

The component ADODB.Connection cannot be created.

I'm trying to migrate some code written in ASP.NET 1.14 to ASP.NET 2.0. We need to upgrade the Trust level as well and get rid of ASPCompat=True.

When I do this, I get this error: Is there an easy way around this error?

The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@dotnet.itags.org. Page aspcompat=true %> page directive.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Web.HttpException: The component 'ADODB.Connection' cannot be created. Apartment threaded components can only be created on pages with an <%@dotnet.itags.org. Page aspcompat=true %> page directive.

Why not set the AspCompat="True" as the exception said?

Iori_Jay:

Why not set the AspCompat="True" as the exception said?

Yeh, thats a good question. Most of the ISP's in support of asp.net 2.0 are only supporting "Medium Trust". Noone will do "high trust" anymore. AspCompat requires High Trust. I realize the routine causing the problem is the generic class that processes the connections to the database. I guess this could be rewritten to use asp.net data connection algorithms, but the program code that calls the class is expecting a RecordSet.

So is my assumption that this would be a total rewrite correct to avoid aspcompat=True?

Saturday, March 24, 2012

The data at the root level is invalid. Line 1, position 1

Hi there,
I got this message ("The data at the root level is invalid. Line 1, position
1.") when I moved the application from my workstation to Windows 2003 web
server. But the wired thing the whole application works fine on my
workstation which running Windows XP prof sp 2 edition.
Please help me out
Thanks
AlanOn Fri, 05 Aug 2005 12:24:33 -0400, Alan Wang wrote:

> Hi there,
> I got this message ("The data at the root level is invalid. Line 1, positi
on
> 1.") when I moved the application from my workstation to Windows 2003 web
> server. But the wired thing the whole application works fine on my
> workstation which running Windows XP prof sp 2 edition.
> Please help me out
> Thanks
> Alan
If ds is your DataSet, you can refer to the tables by name as in
ds.Tables("yourTableName")

The data at the root level is invalid. Line 1, position 1

Hi there,

I got this message ("The data at the root level is invalid. Line 1, position
1.") when I moved the application from my workstation to Windows 2003 web
server. But the wired thing the whole application works fine on my
workstation which running Windows xp prof sp 2 edition.

Please help me out

Thanks

AlanOn Fri, 05 Aug 2005 12:24:33 -0400, Alan Wang wrote:

> Hi there,
> I got this message ("The data at the root level is invalid. Line 1, position
> 1.") when I moved the application from my workstation to Windows 2003 web
> server. But the wired thing the whole application works fine on my
> workstation which running Windows xp prof sp 2 edition.
> Please help me out
> Thanks
> Alan
If ds is your DataSet, you can refer to the tables by name as in
ds.Tables("yourTableName")

The element html occurs too few times.

I am using Beta 2 and have a problem with aspx files in that it is refusing to compile unless I have a top level HTML element. The problem with this is that I do not want to define the top level html in the aspx page, I want to define it in a usercontrol and then load that dynamically at runtime just as I can in ASP.NET 1.1. Surely there are other reasons you would want to have an aspx page without an <html> tag in it, I can think of several, why is there this limitation as it severly limits flexibility.
It says "The element 'html' occurs too few times."
Is there anyway to turn off this error to get it to compile?
Richard
"Surely there are other reasons you would want to have an aspx page without an <html> tag in it"
Like when? an aspx page is goign to spit out an HTML document, so the <html> tag makes perfect sense
Sounds like you have your programming all backwards, the aspx page should have the shell and the user controls should have the dynamic content, not the other way around
Like for example when you are trying to output WAP content for one, or plain text for another.
This is because I need to be able to easily substitute the head sections primarily dynamically, this enables multiple sites to run on the same codebase looking for Host headers to load the appropriate templates, it also allows easy support for text only versions of sites, just by dynamically loading text only versions of the user controls, this is for a database driven website content managed system.
Ive looked into master pages but they dont seem to really allow enough flexibility to do what I need to do as they require the definition of the whole document in them, but maybe ill have to work out some way to fudge it with those.
Im not sure what you are refering to about doing it backwards, the aspx page is the shell that loads up the user controls, and the user controls are what contain the dynamic content.
Hello.
Are you also removing the <head> section from the page? I've noticed in the past that if you remove the <html> tag but leave the <head runat="server"> you'll get that errror when you build the project in VS.
one more thing: you can use "filters" to apply different master pages to different browsers. for instance:

<%@.PageLanguage="C#"ie:MasterPageFile="~/Cap14/IE.master"MasterPageFile="~/Cap14/Mozilla.master"%>
applies a master page to IE and another to the other browsers. Check your browsers files to see the IDs of the browsers... oh, and you can alsouse adapters to render your pages/controls according to your needs in different browsers...


I don't think missing <html> element is an error. It is HTML markup validation message and is supposed to be a warning. Does it really break compilation or the page still runs? You can deal with the message in a few ways. First, you can disable validation in Tools | Options | Text Editor | HTML | Validation. Second, you can edit validation schema in Program Files\...\Common7\Packages\schemas\html (IE6_0.xsd, for example) and delete minOccurs="1" maxOccurs="1" from the <xsd:element name="html" >. Third, instead of using ASPX page, you can define your own file type, add it to the web.config and implement a handler for the type that will generate the response programmatically.

Giving it a fuller test it doesnt seem to break compilation on its own, I was getting other compilation errors too which were actually stopping it, but it does get reported as an error rather than a warning along with the other errors leading you to believe it is stopping compilation and needs to be fixed before you can compile.


I say just ignore it. If you are making an XML page, you can't have the <html> tag, for instance. So, just ignore it. That's what I do.