473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Why can't I run ASP in SharePoint 2007?

1
I have an ASP page that generates XML after querying an MS Access Datbase. But when I upload it to a SharePoint 2007 server, I am not allowed to upload .asp files. So I named it .aspx and uploaded it successfully. When hitting the .aspx page I just uploaded, I get an ERROR page:

Error

An error occurred during the processing of /sites/mysite/portal/xmlgetdata.aspx. Code blocks are not allowed in this file.

Troubleshoot issues with Windows SharePoint Services.

What can I do to make it work? Will I have to convert my classic ASP code to ASP .NET code? If so, can someone help me convert my ASP code to ASP .NET?

Here's the ASP code for xmlgetdata.asp:
Expand|Select|Wrap|Line Numbers
  1. <% @ Language="VBScript" %>
  2. <%
  3.   ' Declare all variables.
  4.   Option Explicit
  5.   Dim objCN,objRS,objField
  6.   Dim strSQL,strCN
  7.   Dim strName,strValue
  8.  
  9.   ' Buffer and output as XML.
  10.   Response.Buffer = True
  11.   Response.ContentType = "text/xml"
  12.  
  13.   ' Start our XML document.
  14.   Response.Write "<?xml version=""1.0""?>" & vbCrLf
  15.   Response.Write "<?xml:stylesheet type=""text/xsl"" href=""xmlrender.xsl""?>" & vbCrLf
  16.  
  17.   ' Set SQL and database connection string.
  18.   strSQL = "SELECT * FROM SubNav"  
  19.   strCN = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=\\server01\mydb1.mdb"
  20.  
  21.   ' Open the database connection and recordset.
  22.   Set objCN = Server.CreateObject("ADODB.Connection")
  23.   objCN.Open strCN  
  24.   Set objRS = objCN.Execute(strSQL)
  25.  
  26.   ' Output start of data.
  27.   Response.Write "<DATABASE>" & vbCrLf
  28.  
  29.   ' Loop through the data records.
  30.   While Not objRS.EOF
  31.     ' Output start of record.
  32.     Response.Write "<RECORD>" & vbCrLf
  33.     ' Loop through the fields in each record.
  34.     For Each objField in objRS.Fields
  35.       strName  = objField.Name
  36.       strValue = objField.Value
  37.       If Len(strName)  > 0 Then strName = Server.HTMLEncode(strName)
  38.       If Len(strValue) > 0 Then strValue = Server.HTMLEncode(strValue)
  39.       Response.Write "<FIELD>" & vbCrLf
  40.       Response.Write "<NAME>" & strName & "</NAME>" & vbCrLf
  41.       Response.Write "<VALUE>" & strValue & "</VALUE>" & vbCrLf
  42.       Response.Write "</FIELD>" & vbCrLf
  43.     Next
  44.     ' Move to next record in database.
  45.     objRS.MoveNext
  46.     ' Output end of record.
  47.     Response.Write "</RECORD>" & vbCrLf
  48.   Wend
  49.  
  50.   ' Output end of data.
  51.   Response.Write "</DATABASE>" & vbCrLf
  52. %>
Thank you in advance for your help guys!!
Sep 19 '11 #1
2 2782
Rabbit
12,516 Expert Mod 8TB
You have to talk to your Sharepoint administrator about adding any pages that have code. It's restricted for security.
Sep 19 '11 #2
Frinavale
9,735 Expert Mod 8TB
I could understand why an administrator wouldn't want ASP pages on their server.

I recommend downloading Visual Studio Express and creating a proper ASP.NET (aspx) page.

You would have to move the code you have posted here into a method that handles the Page Load Event.

You're going to have to make some modifications to use .NET controls instead of the vb code that you're using.

-Frinny
Sep 23 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: AGH | last post by:
I have an Intranet based on ASP.NET 2.0 using Webparts to give a similar experience to Sharepoint. This development was made as Sharepoint 2003 did not suit our needs and Sharepoint 2007 was not...
1
by: =?Utf-8?B?TWF0cmFNNjUw?= | last post by:
We can maintain SSO (single sign on) between SharePoint 2003 and a third party WebSSO provider. This is done by passing to the WebSSO provider the authenticated domain user name and password, then...
8
by: GaryDean | last post by:
I was advised by a Microsoft speaker at a local .Net conference that "SharePoint" had a lot to offer for asp.net developers. I've spent a few hours hunting down links on Sharepoint Services in...
1
by: apondu | last post by:
hi, I am new to Sharepoint Server. I was just trying to install sharepoint server and work with it. I wanted to access the sharepoint server services with dotnet and work with it. I just...
3
by: Wenlei Fang | last post by:
Hi All, Sharepoint 2007 has version control capability, what's your take on using it as the main version control software for a .Net project of about 1 million LOC? Is anyone use it for...
0
by: TheNeil | last post by:
Hi, I've recently been working on an C#/ASP.net (v2) web application that queries a couple of internal SQL 2005 databases, connects to Excel (2007) and then makes the resultant .XLS file available...
1
by: =?Utf-8?B?QWx2aW4=?= | last post by:
I'm new to both asp.net development and sharepoint 2007. I was wondering if it was possible to design an asp.net application first as a standalone web application and later integrate it with...
0
by: =?Utf-8?B?U2FkaG5h?= | last post by:
HI , I am using MOSS 2007 API's to implement the version controls like check in and check out in Visual Studio 2005. I have a sharepoint 2007 server and i am accessing the MOSS API (on...
1
by: Eran Hefer | last post by:
With SharePoint timer jobs you can create & execute processes on a daily / hourly / minutely basis. After deployment, the timer job definition executes your custom code. The easiest (and more...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.