473,795 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Tex t +
@"\C$\windows\S ystem32\LogFile s\";
Line 63:
Line 64: trace.write("FI LE_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="Syst em" %>
<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Diagnostics" %>

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

The error is in a routine:
*************** *************** *************** *************** *************
private void PopulateSiteBox ()
{
drpSiteBox.Item s.Clear();
string FILE_PATH = @"\\" +txtMachine.Tex t +
@"\C$\windows\S ystem32\LogFile s\";

trace.write("FI LE_PATH = ");

DirectoryInfo di = new DirectoryInfo(F ILE_PATH);
foreach(FileSys temInfo fsi in di.GetFileSyste mInfos())
{
if(fsi.Name.Sta rtsWith("W3"))
drpSiteBox.Item s.Add(fsi.Name) ;
}
}

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

Why doesn't is know about it?

Thanks,

Tom.

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

Trace.Write()

-- bruce (sqlwork.com)
"tshad" <ts**********@f tsolutions.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.Tex t +
| @"\C$\windows\S ystem32\LogFile s\";
| Line 63:
| Line 64: trace.write("FI LE_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="Syst em" %>
| <%@ Import Namespace="Syst em.IO" %>
| <%@ Import Namespace="Syst em.Data" %>
| <%@ Import Namespace="Syst em.Diagnostics" %>
|
| <script language="c#" runat="server">
|
*************** *************** *************** *************** *************** *
*****
|
| The error is in a routine:
| *************** *************** *************** *************** *************
| private void PopulateSiteBox ()
| {
| drpSiteBox.Item s.Clear();
| string FILE_PATH = @"\\" +txtMachine.Tex t +
| @"\C$\windows\S ystem32\LogFile s\";
|
| trace.write("FI LE_PATH = ");
|
| DirectoryInfo di = new DirectoryInfo(F ILE_PATH);
| foreach(FileSys temInfo fsi in di.GetFileSyste mInfos())
| {
| if(fsi.Name.Sta rtsWith("W3"))
| drpSiteBox.Item s.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******** ******@tk2msftn gp13.phx.gbl...
C# is case sensitive, try:

Trace.Write()
That was it.

Thanks,

Tom.
-- bruce (sqlwork.com)
"tshad" <ts**********@f tsolutions.com> wrote in message
news:%2******** ********@tk2msf tngp13.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.Tex t +
| @"\C$\windows\S ystem32\LogFile s\";
| Line 63:
| Line 64: trace.write("FI LE_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="Syst em" %>
| <%@ Import Namespace="Syst em.IO" %>
| <%@ Import Namespace="Syst em.Data" %>
| <%@ Import Namespace="Syst em.Diagnostics" %>
|
| <script language="c#" runat="server">
|
*************** *************** *************** *************** *************** *
*****
|
| The error is in a routine:
|
*************** *************** *************** *************** *************
| private void PopulateSiteBox ()
| {
| drpSiteBox.Item s.Clear();
| string FILE_PATH = @"\\" +txtMachine.Tex t +
| @"\C$\windows\S ystem32\LogFile s\";
|
| trace.write("FI LE_PATH = ");
|
| DirectoryInfo di = new DirectoryInfo(F ILE_PATH);
| foreach(FileSys temInfo fsi in di.GetFileSyste mInfos())
| {
| if(fsi.Name.Sta rtsWith("W3"))
| drpSiteBox.Item s.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
3697
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 from solution explorer. My config file is composed of the following, which is almost a verbatum cut & paste from MSDN help: --------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?>...
3
24529
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 understand the Stack Trace, but I want to understand the stack trace so can somebody please explain it to me or point me to something that will Thanks Jeremy
3
1935
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? It actually is happening on 2 machines I work on. Thanks.
9
4443
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" traceMode="SortByTime" localOnly="false" />
0
906
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 is working as I created a simple C# console project to prove it. What could be disabling the trace messages? Thanks. --
6
2175
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 back details which will help us to identify the areas of application crashes. The log file will contain details about the file name, line number and the order of the called functions leading to the crash. The cpp program we had added is...
1
996
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 file. For example, the following simple app: using System; using System.Diagnostics; namespace Test { class Test
1
2697
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
2590
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 getting the following error at the 1st Trace.Warn: *********************************************** Compiler Error Message: CS0118: 'System.Web.UI.Page.Trace' denotes a 'property' where a 'class' was expected
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.