Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

'AspCompat' attribute not allowed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan - 15 Mar 2008 01:37 GMT
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
Peter Bromberg [C# MVP] - 15 Mar 2008 02:15 GMT
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

> 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:
[quoted text clipped - 20 lines]
>
> TIA
Rick Strahl - 15 Mar 2008 21:05 GMT
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 ---

Signature

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

> 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:
[quoted text clipped - 21 lines]
>
> TIA
Jonathan - 16 Mar 2008 17:29 GMT
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

> 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
[quoted text clipped - 36 lines]
> >
> > TIA
Steven Cheng - 18 Mar 2008 02:37 GMT
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:
msdnmg@microsoft.com.

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

--------------------
>From: "Jonathan" <none@none.com>
>References: <eo0wgUjhIHA.5204@TK2MSFTNGP02.phx.gbl>
<EA7487C2-9F96-49C6-A078-98815C7B0F8D@microsoft.com>
>Subject: Re: 'AspCompat' attribute not allowed
>Date: Mon, 17 Mar 2008 04:29:56 +1200

>Thanks.
>
[quoted text clipped - 71 lines]
>> >
>> > TIA
Steven Cheng - 17 Mar 2008 03:21 GMT
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:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Jonathan" <none@none.com>
>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:
[quoted text clipped - 20 lines]
>
>TIA

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.