473,385 Members | 1,919 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,385 software developers and data experts.

Trace not working in C#

I have been working in VB.net and have never had a problem with trace.warn
or trace.write.

I have a test program in C# that is giving me an error:

************************************************** ****************************
Compiler Error Message: CS0246: The type or namespace name 'trace' could
not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 62: string FILE_PATH = @"\\" +txtMachine.Text +
@"\C$\windows\System32\LogFiles\";
Line 63:
Line 64: trace.write("FILE_PATH = ");
************************************************** ****************************

The beginning of my page is:

************************************************** ***************************
<%@ Page Language="C#" trace="true" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Diagnostics" %>

<script language="c#" runat="server">
************************************************** *******************************

The error is in a routine:
************************************************** ***********************
private void PopulateSiteBox()
{
drpSiteBox.Items.Clear();
string FILE_PATH = @"\\" +txtMachine.Text +
@"\C$\windows\System32\LogFiles\";

trace.write("FILE_PATH = ");

DirectoryInfo di = new DirectoryInfo(FILE_PATH);
foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
{
if(fsi.Name.StartsWith("W3"))
drpSiteBox.Items.Add(fsi.Name);
}
}

************************************************** **********************

Why doesn't is know about it?

Thanks,

Tom.

Nov 19 '05 #1
2 1815
C# is case sensitive, try:

Trace.Write()

-- bruce (sqlwork.com)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
| I have been working in VB.net and have never had a problem with trace.warn
| or trace.write.
|
| I have a test program in C# that is giving me an error:
|
|
************************************************** **************************
**
| Compiler Error Message: CS0246: The type or namespace name 'trace' could
| not be found (are you missing a using directive or an assembly reference?)
|
| Source Error:
|
| Line 62: string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
| Line 63:
| Line 64: trace.write("FILE_PATH = ");
|
************************************************** **************************
**
|
| The beginning of my page is:
|
|
************************************************** **************************
*
| <%@ Page Language="C#" trace="true" AutoEventWireup="false" %>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
| <%@ Import Namespace="System" %>
| <%@ Import Namespace="System.IO" %>
| <%@ Import Namespace="System.Data" %>
| <%@ Import Namespace="System.Diagnostics" %>
|
| <script language="c#" runat="server">
|
************************************************** **************************
*****
|
| The error is in a routine:
| ************************************************** ***********************
| private void PopulateSiteBox()
| {
| drpSiteBox.Items.Clear();
| string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
|
| trace.write("FILE_PATH = ");
|
| DirectoryInfo di = new DirectoryInfo(FILE_PATH);
| foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
| {
| if(fsi.Name.StartsWith("W3"))
| drpSiteBox.Items.Add(fsi.Name);
| }
| }
|
| ************************************************** **********************
|
| Why doesn't is know about it?
|
| Thanks,
|
| Tom.
|
|
|
Nov 19 '05 #2
"bruce barker" <no***********@safeco.com> wrote in message
news:OR**************@tk2msftngp13.phx.gbl...
C# is case sensitive, try:

Trace.Write()
That was it.

Thanks,

Tom.
-- bruce (sqlwork.com)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
| I have been working in VB.net and have never had a problem with
trace.warn
| or trace.write.
|
| I have a test program in C# that is giving me an error:
|
|
************************************************** **************************
**
| Compiler Error Message: CS0246: The type or namespace name 'trace'
could
| not be found (are you missing a using directive or an assembly
reference?)
|
| Source Error:
|
| Line 62: string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
| Line 63:
| Line 64: trace.write("FILE_PATH = ");
|
************************************************** **************************
**
|
| The beginning of my page is:
|
|
************************************************** **************************
*
| <%@ Page Language="C#" trace="true" AutoEventWireup="false" %>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
| <%@ Import Namespace="System" %>
| <%@ Import Namespace="System.IO" %>
| <%@ Import Namespace="System.Data" %>
| <%@ Import Namespace="System.Diagnostics" %>
|
| <script language="c#" runat="server">
|
************************************************** **************************
*****
|
| The error is in a routine:
|
************************************************** ***********************
| private void PopulateSiteBox()
| {
| drpSiteBox.Items.Clear();
| string FILE_PATH = @"\\" +txtMachine.Text +
| @"\C$\windows\System32\LogFiles\";
|
| trace.write("FILE_PATH = ");
|
| DirectoryInfo di = new DirectoryInfo(FILE_PATH);
| foreach(FileSystemInfo fsi in di.GetFileSystemInfos())
| {
| if(fsi.Name.StartsWith("W3"))
| drpSiteBox.Items.Add(fsi.Name);
| }
| }
|
| ************************************************** **********************
|
| Why doesn't is know about it?
|
| Thanks,
|
| Tom.
|
|
|

Nov 19 '05 #3

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

Similar topics

2
by: Richard | last post by:
Hi, I'm having trouble setting up a config file based trace switch & listener. I added an application config file to my console based C# program using the "Add New Application Config File" button...
3
by: Jeremy | last post by:
While working with ASP.NET I've sometimes encountered errors in my applications, but I've always known exactly why I'm getting the error and have been able to fix it. So I've never needed to...
3
by: JR | last post by:
I'm experiencing a problem where, for seemingly no reason, trace output stops being logged (and appearing on my pages.) trace.enabled suddenly just turns to false. Any idea why this happens?...
9
by: Joe Rattz | last post by:
I can't seem to get to trace.axd. I have turned tracing on in web.config. Here is how I currently have i configured: <trace enabled="true" requestLimit="10" pageOutput="false"...
0
by: McGeeky | last post by:
Hi. I regularly use System.Diagnostics.Trace. I had been using it in a web service with no problems. But when I ran the web service on a different computer I no longer get the trace messages. Trace...
6
by: saju.prabhakaran | last post by:
We have an application developed in c++ and the development environment is visual studio .net 2003. We have added a cpp program to the application which will create a log file containing the trace...
1
by: ThePants999 | last post by:
Hi guys, I'm trying to get to grips with the System.Diagnostics.Trace class, and I just can't get any output to go to file. Whenever I use a TextWriterTraceListener, all I ever get is an empty...
1
by: twowaystosayiloveyou | last post by:
Hi all, After setting trace for asp.net application. I get trace information for every page, but no trace information for global.asax. Anyone know how to trace the global.asax file? Thanks.
2
by: tshad | last post by:
I have a page with Trace.Warns statements in my Page_Load and functions that it calls, but it doesn't seem to work in a class that is defined on the same page. I am writing this in C# I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.