Answer Questions
Thams StreamReader and StreamWriter
I have problems using StreamReader and StreamWriter. everytime i copied a textfile from StreamReader to StreamWriter. the files bytes are in different size. please need help on this matter. ok i tried but the file is different bytes again the source file is 38060 bytes the destination 38788 bytes , how could the destination file had a different bytes copied no idea, working well here :) if you want to copy a file, just do: System.IO.File.Copy(Source, Destination); if these are textfile, try this: Dim theReader as new StreamReader("file.txt") Dim theWriter as new StreamWriter("copyfile.txt") theWriter.Write(theReader ...Show All
schmod54 Dynamically remove object member
Hi All, I am using .NET 2.0 and wondering is there a way to dynamically remove a field from the object for example, class Foo { private int age; private string name; } Now using reflection, can i remove the field age dynamically so that when i use reflection to enumerate through all the properties, i do not get this. OR another option would be if i can add NonSerialized attribute to this field dynamically Any help would be greatly appreciated. Thanks, Salim No. If it is for serialization purposes, then you can implement ISerializable and do what you like. ...Show All
Jean-Pierre Fouche Memory Issues
Hello all, I've been trying to profile my ASP.NET application on my application server. I set up 2 counters for aspnet_wp process namely '#bytes in all heaps' and 'process:private bytes'. According to a documentation that i read, '#bytes in all heaps' should be less that 'process: private bytes'. However the '#bytes in all heaps' was far greater than that of the 'process: private bytes'. I'm lead to believe that this indicates a memory leak somewhere. Now, the problem is that i've got 15 ASP.NET applications running on that server and i need to find which application(s) are causing the problem. Please i'll need help on which counters to set up that will enable me pin point the rouge application. Thanks Emeka. ...Show All
Macinkross Generating C# classes from an XML Schema in Visual Studio 2005
I'm looking for some help understanding the XML Schema tool support in Visual Studio 2005, and how to use them with .NET Framework's XmlSerializer. The XML data I'm working on seems typical of the challenges may arise in trying to use web services across different platforms, so I'd like to write up the approach in a how-to type article. I'm starting with three .xsd files which describe an XML API for Microsoft Office Live Meeting. The schema can be downloaded from http://www.microsoft.com/downloads/details.aspx FamilyId=AC48894B-9471-41C2-9B44-170655F400CC&displaylang=en . This schema is fairly complex, and not generated from a .NET project. For the purpose of this discussion, lets assume I don't own the schema definitions, I'm ju ...Show All
Darth Hamsy C# Splash Screen while loading .NET assemblies
Hi, is there any way how to display a splash screen with informations about loading .NET assemblies I am looking for something like is used in program RegToy ( http://greenfield.kn.googlepages.com/home ). This program is competely in .NET, so I hope there must be a solution... You could write an event handler for AppDomain.AssemblyLoad(). A generic example: static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(ShowAssemblies); Application.EnableVisualStyles(); Application.SetCompatibleTextRe ...Show All
JonH66 impersonating the user initiating an action over the network
I am trying to write a simple server/client application that will perform operations on the server using the permissions of the person running the client. I have saught to do this by serializing a WindowsIdentity object representing the client and sending it through a NetworkStream that is connected to the server (which will run as a windows service). Then I attempt to impersonate the user on the server using the WindowsIdentity object. Well, aparently the WindowsIdentity object does not contain a full set of credentials because once it gets to the server it simply sais that the handle is bad. I can see how this situation would happen, but what to I need to do to transmit the user's security token to another comput ...Show All
cplusplus1 Failing to Catch Exception
Hi folks, I have a WinForm app, written in MS Video Studio .NET C++ 2003, that examines folders in the systems main drive (ie. C:\). Whenever it comes across the "System Volume Information" file, access is denied and the program presents a dialog window indicating the following: "An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll. Additional information: Access to the path "c:\System Volume Information\" is denied." I've tried catching this exception, but can't seem to do it. So far I've tried: catch (IOException* e) { } catch (System::UnauthorizedAccessException* e) { } But neither seems to handle the exception. What exception should I be tryin ...Show All
Clinic332050 Exposing .NET Framework Components to COM
Hello everybody, I am trying to execute the "nice" example taken from ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxinterop/html/a219cb2c-9fa2-4c90-9b26-939e0788f178.htm, unfortunatelly , in the file ConLoan.cpp which contains the following code: #include "stdafx.h" #import "..\LoanLib\LoanLib.tlb" raw_interfaces_only using namespace LoanLib; the compiler doesn't recognize the namespace LoanLib even although I imported the tlb file, and although the dll is in the same directory where the main is located,; also , when I am writing the line that is written there ILoanPtr pILoan(__uuidof(Loan)); the compiler doesn't recognize that, (by the way , shouldn't they write ILoan pILo ...Show All
Georgiev Accepting multiple requests in server socket
Hi, I want my server socket to accept mutiple requests arriving simultaneously. How can I acheive this Thanks very much Awesome! Thanks for the info, I understand how it needs to be done now, only thing I'm not sure on is hashtables, is there an acctual Hashtable class in .NET 2.0 or is this something I'll need to build my self Maybe use a couple different List classes to store the info in Yes .Net framework has Hashtable class under System.Collections namespace but if you are using .Net 2.0 then you should prefere using Dictionary class which can be found under System.Collections.Generic namespace. Which saves objects in their native types as compare to Hashtab ...Show All
Puntor NetworkStream.Flush() disabled at NET 2?
Hi! My program sends more than one msg at a time, and I wanted to avoid the reciever to recieve it as one msg, eg: server.send("123"); server.send("abc"); the reciever would get "123abc". <<<<<---- not wanted ! I tried to use Flush() but it seem not to be working, plus, in the function description it's says something like "This method is reserver for future use."...... Any suggestions good people Well, web servers apps parse a lot of textual data and they seem to get away with that pretty well. HTTP posts for example rely on a simple pattern where each header ends with a new line character. So reading headers line by line is quite ease. ...Show All
David Marley COM+ EnterpriseServices distributed transaction between XP SP2 and Windows 2003 SP1 fails
In my system ClientApp.exe calls ComPlusApp1.dll on XP and ComPlus1.dll calls ComPlusApp2.dll on Windows 2003. I get error << System.Runtime.InteropServices.COMException (0x8004E003): You made a method call on a COM+ component that has a transaction that has already aborted or in the process of aborting. >> I have ClentApp.exe and ComPlusApp1.dll on XP: using System; using System.EnterpriseServices; namespace ComPlusApp1{ [assembly: AssemblyVersion("1.0.1.1")] [assembly: AssemblyKeyFile("..\\..\\ComPlusApp1.snk")] [assembly: ApplicationName("ComPlusApp1")] [assembly: ApplicationActivation(ActivationOption.Server)] ...Show All
sabo What is URL for Map Point Webservice Version 4
Hi, I want to upgrade Map Point Web Service url to Version 4. Old URL are : The URLs for the MapPoint Web Service staging environment are as follows: Find service: https://findv3.staging.mappoint.net/Find-30/findservice.asmx Render service: https://renderv3.staging.mappoint.net/render-30/renderservice.asmx Route service: https://routev3.staging.mappoint.net/Route-30/routeservice.asmx Common service: https://findv3.staging.mappoint.net/Find-30/common.asmx I want same urls for Version 4 Please tell me ASAP. Thanks, Nitin ...Show All
Hardrock302 XML Serialization/Deserialization with an already Serializated/Deserializated element
Hello, is it possible to have public class MyClass { string keyname XmlNode keyvalue } public class List<MyClass> { } serialized as : <ListOfMyClass> <MyClass> <KeyName>MyKey1</KeyName> <KeyValue> any XML structure stored in XMLNode for example <element1> <value1>Value</value1> <value2>Value</value2> </element1> </KeyValue> </MyClass> <MyClass> <KeyName>MyKey1</KeyName> <KeyValue> any XML structure stored in XMLNode </KeyValue> </MyClass> </ListOfMyClass> I think it work ...Show All
HandMap About the implementation of netstat using .NET Framework
I have spent plenty of time in implementing the functions of netstat by using .NET Framework2.0. I found that I can implement some functions of netstat(for example, -np TCP, -s) when using the classes in NetworkInformation Namespace. But I don't how to implement the functions listed below: netstat -r netstat -e Could anyone give me any suggestion You have one implementation for netstat in MSDN. http://msdn2.microsoft.com/en-us/library/ks32hs88.aspx Hope this helps. Its very useful!!!Thank you very much! You may need to P/Invoke. See the native IP Helpers APIs. http://windowssdk.msdn.microsoft.com/en-us/library/ms691203.aspx ...Show All
SkyCyclePilot How is a true GetHashCode() possible . . .
Consider this base class: public abstract BaseClass<T> : IEquatable<BaseClass<T>> where T : IComparable<T> { public T Id { get { ... } } protected BaseClass(T id) { ... } public override bool Equals(BaseClass baseClass) { return (Id.CompareTo(baseClass.Id) == 0); } public int GetHashCode() { return Id.GetHashCode(); } } This is a valid implementation of GetHashCode because: If two BaseClass instances are equal, so will be their hash code The hash code will not change over time, since the ID doesn't change Now what if I want to allow the ID to change I can no longer guarantee that GetHashCode() will return the same value for a single BaseClass instance over time. ...Show All
