|
Are your UserInfoCollection and UserInfo classes marked as Serializable?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey,
First of all thanks for your reply.
The classes are not marked as Serializable, but I also have a function in the WebService that returns a UserInfo object and it works perfect. If I use the UserInfoCollection...problems. I found some way to go around, but this bugs me a lot...because I can't understand why it's doing this.
Do your best to be the best
|
|
|
|
|
The data you want to expose need to be public. Remember webservices only make a wrapper for your class's public data.
|
|
|
|
|
Hey,
Thanks for your reply.
The classes are marked as public and the methods that I need are also public, but in debug mode when the webservice returns the collection object first of all it reinitialize my private objects and then calls the constructor of the class. These classes I talk about are wrapped in a DLL and imported in the WS.
Do your best to be the best
|
|
|
|
|
Hi,
I'm working on a app which workspace is contained in one splitcontainer that for its turn is also inside a splitcontainer.
That workspace is a form and i told it to always maximize.
If i want to make always maximized i told the splitcontainers to do the following operations when moved:
if (workspace != null)
{
workspace.WindowState = FormWindowState.Normal;
workspace.WindowState = FormWindowState.Maximized;
}
The thing is that i cant see a imediate adapation of the form. I can perfectly note is getting smallerand then getting bigger, occupiyng the full area.
Is there a way of making this adaptation more smooth?
Thx,
Best regards,
Nuno
|
|
|
|
|
Hi All,
Can anyone explain me in detail on creating different versions of dlls, creating Strong names, and implemeting the dll in a client application. I want to use both the versions of the dll in my client application.
Please explain with steps i have to make..
Thanking you All,
Umashanker.K
|
|
|
|
|
|
Any other explanaton other than the above reply, is highly appreciated.. I need to know step by step and want to understand the concepts of strong name, dll versioning and GAC.. Will any one help me..
Umashanker.K
|
|
|
|
|
|
Hi,
I'm developing an Windows Application with C#. In that the application will read an input file while starting. This input file contains a version no in the first line, then heading, then an underline. I need to read the data after this underline. Following is the code I have written for fetching the path for input file and read the lines:
FileStream fspath = new FileStream(strLiveRicsFilePath,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
StreamReader srReadFile = new StreamReader(fspath,System.Text.Encoding.UTF8);
string readline;
readline = srReadFile.ReadLine();
Now I want to tell the StreamReader to read the data after the underline. How to code the same in C#. Any help in this regard would be great. Thanks in advance.
Meeram395
|
|
|
|
|
Just call ReadLine three times - or until you read the underline or something.
If you know the length in bytes, you can also seek to the right posistion. This will save you at a fraction of a milisecond in performance, and in return leave you with some fragile code that will break wihout warning if anything change - your choice.
|
|
|
|
|
You can't really avoid reading them so just use a counter variable and don't do anything with the first 3 lines.
|
|
|
|
|
Is it a text file?
If it is, I would basically put streamReader.ReadLine() three times before I pick the fourth line which would be line you want to work on.
You can your streamreader any name.
I hope this helps
khuzym
|
|
|
|
|
I am creating programs that send and receive files using TCP protocol.
A client and server modules are created and communication between them is through "System.Net.Sockets". Thread is needed for listening to client connection request.
The connection between server and client is restricted to 30 minutes. In my program, the server module enables a 30 min timer when there is a client connection . The timer tick method should be called to disconnect the client after 30 min.
Problem is the tick method is not executed even though the timer is enabled. Pls help if you know where have got wrong. Thanks in advance.
My code at server module:
<u>listen to client</u>
th = new Thread(new ThreadStart(ListenForPeers));
th.IsBackground = true;
th.Start();
<u>ListenForPeers</u>
public void ListenForPeers()
{
//=====Standard socket method======
serversocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
serversocket.Blocking = true ;
IPHostEntry IPHost = Dns.Resolve(server);
string []aliases = IPHost.Aliases;
PAddress[] addr = IPHost.AddressList;
IPEndPoint ipepServer = new IPEndPoint(System.Net.IPAddress.Parse(IP_ADDRESS.Text), 8090);
serversocket.Bind(ipepServer);
serversocket.Listen(-1);
while (runThread) //<<====Start thread to listen to client connection, when server is ready ===
{
clientsock = serversocket.Accept();
if ( clientsock.Connected )
{
total_clients_connected++; // increment client connection counter
if(connectionTimer.Enabled == false) //<<===Enable the timer if it is not able==
{ connectionTimer.Enabled = true; //<<=== Start 30 min timer
}
Thread tc = new Thread(new ThreadStart(listenclient)); //listen to client command call
tc.IsBackground = true;
tc.Start();
}
}
}
|
|
|
|
|
I can see one flaw in the code. Your server app allows n clients to connect, each processed on their own thread while it's the listener thread that seems to be maintaining a timeout check with only one timer. Thus the actual timeout would be 30 mins since the last client connected!
That aside there's not enough code / information here to really determine the issue. I assume you're using the System.Windows.Forms flavour of Timer rather then System.Timers.Timer ?
Duration set to 1800000 (ms)?
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Hi,
Thanks for pointing my flaw. I manage to use System.Threading.Timer to solve my problem
Thanks alot.
Rdgs
|
|
|
|
|
Hello
I am trying to access/read registry of a remote system. I am using RemoteRegistry but is giving Exception : Attempted to perform an unauthorized operation. So i want change the permission to read registry programmatically.
Thanks
Devesh Mishra
|
|
|
|
|
The point of permissions is that they stop you doing things you're not allowed to. Now, if you could change them remotely, what would the point be ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for your reply..
But tell me how can i change the permission through program and i dont want to change the permission remotely. I want to change the permission by running that application on remote system. is it possible ???
Thanks
Devesh Mishra
|
|
|
|
|
It is possible, I've seen it before, google it.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
That error is saying the account your code is running under doesn't have the permissions to read the registry on the remote machine. You simply cannot get around this.
You have to use an account that the remote machine can authenticate, such as a Domain Admin account in a domain or AD environment.
In a workgroup environment, the account your code runs under must exist on all the machines you want to connect to AND all those accounts must have the same password.
|
|
|
|
|
Hi,
While executing following line i an getting XML exception
<br />
XslTransform xslt = new XslTransform();<br />
XPathNavigator navigator = xsldoc.CreateNavigator(); try<br />
{<br />
xslt.Load(navigator, null, null);<br />
}<br />
catch(Exception ex)<br />
{<br />
logger.Error("Ex:" + ex.Message + ":" + ex.StackTrace);<br />
}<br />
<br />
Sometimes the above code throws exception with stack strace given below.
<br />
(19,2) :<br />
at System.Xml.Xsl.Compiler.Compile(NavigatorInput input, XmlResolver xmlResolver, Evidence evidence)<br />
at System.Xml.Xsl.XslTransform.Compile(XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence)<br />
at System.Xml.Xsl.XslTransform.Load(XPathNavigator stylesheet, XmlResolver resolver, Evidence evidence)<br />
I looked at MSDN for these function which mentions that this will work only on .Net FrameWork 1.1
On my machine. I have 1.1, 1.1 with hotfixes, 2.0 and 3.0. FrameWork installed.
Regards
Abhi Lahare
|
|
|
|
|
Hello,
I have a strange problem. I want to send some objectes over Ethernet (UDP One packet is one object) After that I Deserialize the data, but I get allways an exception that there is an Invalid binaryheader. I don't have any idea how I can solve it.
my code is
<br />
int size = socket.Receive(buf);<br />
BinaryFormatter serializer = new BinaryFormatter();<br />
MemoryStream ms = new MemoryStream(buf,0,size);<br />
ms.Seek(0, SeekOrigin.Begin);<br />
LogMessage logMessage = (LogMessage)serializer.Deserialize(ms);<br />
Console::WriteLine("{0}", logMessage.ToString());<br />
ms.Close();<br />
and the sending function:
<br />
MemoryStream ms = new MemoryStream();<br />
BinaryFormatter serializer = new BinaryFormatter();<br />
<br />
serializer.Serialize(ms, logMessage);<br />
ms.Flush();<br />
ms.Seek(0, SeekOrigin.Begin);<br />
<br />
byte[] data = ms.ToArray();<br />
socket.Send(data);<br />
ms.Close();<br />
I have checked the MemoryStream and there is the whole data available (Sending and receiving)
LogMessage
Best regards
Hansjörg
|
|
|
|
|
Are you serializing and deserializing using the same .NET Frameowrk / Operating System?
If you are serializing in, for instance, .NET Framework and the deserializing in .NET Compact Framework, this will be an issue.
Otherwise, you can use the XML Serializer, if platform/framework is your problem
|
|
|
|
|
I use the same computer, same plattform and the both projects are in the same solution from vs2005..
I want to use the binary formatter, because I think it is faster and this is needed in my case.
Best regards
Hansjörg
|
|
|
|