PC Review


Reply
Thread Tools Rate Thread

'AspCompat' attribute not allowed

 
 
Jonathan
Guest
Posts: n/a
 
      15th Mar 2008
I'm trying to move a asp.net website to a new site hosted by Godaddy.com.
When I try to browse and aspx page with ADO in it, I get:

Parser Error Message: The current trust level does not allow use of the
'AspCompat' attribute

Source Error:

Line 29: </head>
Line 30:
Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>


Godaddy said on the phone they don't allow aspcompat="True". I assume I need
it for the code that says:

sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
Cnxn = Server.CreateObject("ADODB.Connection")
Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
Info=TRUE;" & "Data Source=" & sPath, "Admin", "")

What are the options? Is there another line of code I can add to make it
work somehow?

TIA



 
Reply With Quote
 
 
 
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      15th Mar 2008
GoDaddy.com is notorious for the ridiculous and inappropriate restrictions
they put on hosted sites. I once started a site with them and it wouldn't
even allow an outbound HttpWebRequest. They never disclose ANY of this
information up front - you have to find out "after the fact".
My advice? Find another hosting company right away and cut your losses.

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"Jonathan" wrote:

> I'm trying to move a asp.net website to a new site hosted by Godaddy.com.
> When I try to browse and aspx page with ADO in it, I get:
>
> Parser Error Message: The current trust level does not allow use of the
> 'AspCompat' attribute
>
> Source Error:
>
> Line 29: </head>
> Line 30:
> Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>
>
>
> Godaddy said on the phone they don't allow aspcompat="True". I assume I need
> it for the code that says:
>
> sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
> Cnxn = Server.CreateObject("ADODB.Connection")
> Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
> Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
>
> What are the options? Is there another line of code I can add to make it
> work somehow?
>
> TIA
>
>
>
>

 
Reply With Quote
 
Rick Strahl
Guest
Posts: n/a
 
      15th Mar 2008
Peter's right - run away from GoDaddy if you think you have any code that
requires security settings. They are horribly inflexible and will not work
with you to get security issues resolved.

However your particular problem is due to using COM for ADO data access. You
can change your code to use ADO.NET instead and use the ADO.NET OleDb
provider instead. It will require code changes.

I assume you're migrating some older ASP classic code if you're using the
COM ADO classes. If rewriting for ADO.NET is not an option you'd probably be
much better off using classic ASP which will perfom better with the COM
objects than ADO.NET will and would let you get around the security issues.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com/weblog


"Jonathan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to move a asp.net website to a new site hosted by Godaddy.com.
> When I try to browse and aspx page with ADO in it, I get:
>
> Parser Error Message: The current trust level does not allow use of the
> 'AspCompat' attribute
>
> Source Error:
>
> Line 29: </head>
> Line 30:
> Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>
>
>
> Godaddy said on the phone they don't allow aspcompat="True". I assume I
> need
> it for the code that says:
>
> sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
> Cnxn = Server.CreateObject("ADODB.Connection")
> Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
> Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
>
> What are the options? Is there another line of code I can add to make it
> work somehow?
>
> TIA
>
>
>


 
Reply With Quote
 
Jonathan
Guest
Posts: n/a
 
      16th Mar 2008
Thanks.

When you say "It will require code changes", I wonder if you can help me
identify them? This is what I have:

<%@ Page language="VB" Debug="true" aspcompat="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
Cnxn = Server.CreateObject("ADODB.Connection")
Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
Info=TRUE;" & "Data Source=" & sPath, "Admin", "")

rs = server.createobject("adodb.recordset")
rs.open(strSQLChange, Cnxn, 2, 2)

If rs.EOF Then 'No records
bolLoggedIn = False
Else
bolLoggedIn = True
strCookieFirstName = rs("UserFirstName").Value
strCookieLastName = rs("UserLastName").Value
strLoggedInEmailAddress = strEmailAddress
End If

rs.Close
rs = Nothing
Cnxn.Close
Cnxn = Nothing



"Rick Strahl" <(E-Mail Removed)> wrote in message
news:EA7487C2-9F96-49C6-A078-(E-Mail Removed)...
> Peter's right - run away from GoDaddy if you think you have any code that
> requires security settings. They are horribly inflexible and will not work
> with you to get security issues resolved.
>
> However your particular problem is due to using COM for ADO data access.

You
> can change your code to use ADO.NET instead and use the ADO.NET OleDb
> provider instead. It will require code changes.
>
> I assume you're migrating some older ASP classic code if you're using the
> COM ADO classes. If rewriting for ADO.NET is not an option you'd probably

be
> much better off using classic ASP which will perfom better with the COM
> objects than ADO.NET will and would let you get around the security

issues.
>
> +++ Rick ---
>
> --
>
> Rick Strahl
> West Wind Technologies
> www.west-wind.com/weblog
>
>
> "Jonathan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I'm trying to move a asp.net website to a new site hosted by

Godaddy.com.
> > When I try to browse and aspx page with ADO in it, I get:
> >
> > Parser Error Message: The current trust level does not allow use of the
> > 'AspCompat' attribute
> >
> > Source Error:
> >
> > Line 29: </head>
> > Line 30:
> > Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>
> >
> >
> > Godaddy said on the phone they don't allow aspcompat="True". I assume I
> > need
> > it for the code that says:
> >
> > sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
> > Cnxn = Server.CreateObject("ADODB.Connection")
> > Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
> > Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
> >
> > What are the options? Is there another line of code I can add to make it
> > work somehow?
> >
> > TIA
> >
> >
> >

>



 
Reply With Quote
 
Steven Cheng
Guest
Posts: n/a
 
      17th Mar 2008
Hi Jonathan,

Yes, as other members have suggested, the error is due to the current .NET
Code access security level of your ASP.NET application is restricted and
does not allow you to use "AspCompat" attribute on aspx page. This is a
common problem when you host page in a publish web hoster. If the webhoster
will not allow elevated code access security, I'm afraid you may consider
migrating those ASPCOMPAT page's code to .NET code so as to avoid the
problem.

Here are some reference about Code Access Security and ASP.NET:

#How To: Use Code Access Security in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998326.aspx

#ASP.NET Code Access Security
http://msdn2.microsoft.com/en-us/library/87x8e4d1.aspx

Hope also helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Jonathan" <(E-Mail Removed)>
>Subject: 'AspCompat' attribute not allowed
>Date: Sat, 15 Mar 2008 13:37:31 +1300


>
>I'm trying to move a asp.net website to a new site hosted by Godaddy.com.
>When I try to browse and aspx page with ADO in it, I get:
>
>Parser Error Message: The current trust level does not allow use of the
>'AspCompat' attribute
>
>Source Error:
>
>Line 29: </head>
>Line 30:
>Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>
>
>
>Godaddy said on the phone they don't allow aspcompat="True". I assume I

need
>it for the code that says:
>
>sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
>Cnxn = Server.CreateObject("ADODB.Connection")
>Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
>Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
>
>What are the options? Is there another line of code I can add to make it
>work somehow?
>
>TIA
>
>
>
>


 
Reply With Quote
 
Steven Cheng
Guest
Posts: n/a
 
      18th Mar 2008
Hi Jonathan,

From the code you provided, you're still using the VB6 ADO objects to
connect access database. In .net framework you can use the new OleDb
provider:

#Walkthrough: Editing an Access Database with ADO.NET
http://msdn2.microsoft.com/en-us/library/ms971485.aspx

However, as far as I know, OleDBProvider also require Full permission trust
level (for CAS settings), mentioned in the article I mentioned earlier:

#How To: Use Code Access Security in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998326.aspx

therefore, I'm afraid the host provider's policy restriction become the
main bottleneck here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "Jonathan" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<EA7487C2-9F96-49C6-A078-(E-Mail Removed)>
>Subject: Re: 'AspCompat' attribute not allowed
>Date: Mon, 17 Mar 2008 04:29:56 +1200


>Thanks.
>
>When you say "It will require code changes", I wonder if you can help me
>identify them? This is what I have:
>
><%@ Page language="VB" Debug="true" aspcompat="True" %>
><%@ Import Namespace="System.Data" %>
><%@ Import Namespace="System.Data.OleDb" %>
>
>sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
>Cnxn = Server.CreateObject("ADODB.Connection")
>Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
>Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
>
> rs = server.createobject("adodb.recordset")
> rs.open(strSQLChange, Cnxn, 2, 2)
>
> If rs.EOF Then 'No records
> bolLoggedIn = False
> Else
> bolLoggedIn = True
> strCookieFirstName = rs("UserFirstName").Value
> strCookieLastName = rs("UserLastName").Value
> strLoggedInEmailAddress = strEmailAddress
> End If
>
> rs.Close
> rs = Nothing
> Cnxn.Close
> Cnxn = Nothing
>
>
>
>"Rick Strahl" <(E-Mail Removed)> wrote in message
>news:EA7487C2-9F96-49C6-A078-(E-Mail Removed)...
>> Peter's right - run away from GoDaddy if you think you have any code that
>> requires security settings. They are horribly inflexible and will not

work
>> with you to get security issues resolved.
>>
>> However your particular problem is due to using COM for ADO data access.

>You
>> can change your code to use ADO.NET instead and use the ADO.NET OleDb
>> provider instead. It will require code changes.
>>
>> I assume you're migrating some older ASP classic code if you're using the
>> COM ADO classes. If rewriting for ADO.NET is not an option you'd probably

>be
>> much better off using classic ASP which will perfom better with the COM
>> objects than ADO.NET will and would let you get around the security

>issues.
>>
>> +++ Rick ---
>>
>> --
>>
>> Rick Strahl
>> West Wind Technologies
>> www.west-wind.com/weblog
>>
>>
>> "Jonathan" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > I'm trying to move a asp.net website to a new site hosted by

>Godaddy.com.
>> > When I try to browse and aspx page with ADO in it, I get:
>> >
>> > Parser Error Message: The current trust level does not allow use of the
>> > 'AspCompat' attribute
>> >
>> > Source Error:
>> >
>> > Line 29: </head>
>> > Line 30:
>> > Line 31: <%@ Page language="VB" Debug="true" aspcompat="True" %>
>> >
>> >
>> > Godaddy said on the phone they don't allow aspcompat="True". I assume I
>> > need
>> > it for the code that says:
>> >
>> > sPath = "D:\inetpub\www\myuser\fpdb\db.mdb"
>> > Cnxn = Server.CreateObject("ADODB.Connection")
>> > Cnxn.open("Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security
>> > Info=TRUE;" & "Data Source=" & sPath, "Admin", "")
>> >
>> > What are the options? Is there another line of code I can add to make

it
>> > work somehow?
>> >
>> > TIA
>> >
>> >
>> >

>>

>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
aspcompat performance problem Cosmin Microsoft ASP .NET 3 11th May 2009 02:53 PM
"ASPCompat" attribute =?Utf-8?B?U2VyZ2lvIE1hcnRpbnM=?= Microsoft ASP .NET 2 12th Nov 2007 09:12 AM
AspCompat causes CCW count to grow =?Utf-8?B?Ui4gVG9kZA==?= Microsoft ASP .NET 0 22nd Jun 2005 05:53 AM
ASPCompat mode =?Utf-8?B?U3RldmU=?= Microsoft ASP .NET 2 20th May 2004 08:31 AM
arrays not allowed in attribute contructor arguments? Bob Microsoft VB .NET 0 9th Feb 2004 09:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 PM.