473,401 Members | 2,139 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,401 software developers and data experts.

ASPX and C# file on SharePoint Server

Hi. I'm not sure whether this is a SharePoint or an ASP problem... but I
thought it made sense to post here.

I'm having trouble instantiating a C# class from within my ascx file. When
I attempt to run it on our SharePoint 2007 server, I receive this error in
the log file: "System.Web.HttpCompileException: c:\Program Files\Common
Files\Microsoft Shared\web server
extensions\12\TEMPLATE\CONTROLTEMPLATES\ASPNETCont rol\ASPNETControl.ascx(12):
error CS0103: The name 'Class1' does not exist in the current context"

How do I allow the program to recogonize Class1? When I rewrite the aspx
file to return an ordinarily string, it funcitons fine, as long as I don't
call the outside class. Class1 was compiled correctly and it exists as
bin\Class1.dll.

Any advice would be appreciated, and I have my code below. Thanks!

-Drew Carter

GetUsername.ascx:

<%@ Control Language="C#" AutoEventWireup="true" ClassName="GetUsername" %>

<script runat ="server" >

protected override void Render(HtmlTextWriter UI)

{
Class1 output = new Class1();
UI.Write(output);

}

</script>

Class1.cs

using System;

public class Class1
{
public Class1()
{}
public static string getUserName()
{
return "Class1 String";
}
}
Apr 18 '07 #1
1 2245
Drew Carter wrote:
Hi. I'm not sure whether this is a SharePoint or an ASP problem...
but I thought it made sense to post here.
I can't say about Sharepoint, but I'm certain it's not an ASP problem ...
perhaps ASP.Net.

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic asp newsgroup. ASP.Net bears
very little resemblance to classic ASP so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Apr 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Joseph Geretz | last post by:
Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure...
7
by: zxkuqyb | last post by:
I've written a simple ASP .NET web application that reads a text file and displays it in the web browser. Works fine when reading a local path; but fails with "can not find a part of the path", or...
3
by: Joel | last post by:
Hi, I have an XML file at http://localhost/test.xml that I want to read and then update. I can get and read the file no problem with GetResponseStream etc... The code (see 2 examples below) I...
0
by: cherry | last post by:
Dear All, I have written a program in sharepoint, in which will call a Web Service of another Sharepoint portal server so that documents from sharepoint portal server A can push document to...
1
by: John Bailo | last post by:
I'm trying to extract some basic information about /Sharepoint/ from the muck of marketing hype and technical documents. Perhaps someone can help. I think I can: 1. Set up a Sharepoint web...
2
by: marek zegarek | last post by:
Hello! On my server I have Sharepoint portal server as default web site I create there a web application folder with form.aspx file. When I'm trying to run aspx, i get an error. Page is trying...
9
by: =?Utf-8?B?TWF0dE0=?= | last post by:
Is there a way to display/render an ASP page inside of an ASPX page with ASP ..Net 2.0? I'm not trying to back into frames but I have an application that will allow me to customize complex rendered...
2
by: =?Utf-8?B?QWxhc3RhaXIgQmVsbA==?= | last post by:
I am having trouble creating a web site on a server running sharepoint services. I am creating an ASP.Net website using Visual Studio 2005. The server I am trying to create it on is a Windows 2003...
20
by: Neil | last post by:
What is Sharepoint, and should I care?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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.