Re: [ADVANCED-DOTNET] Serialization Problem
Thomas is right, first of all check if the bug is in the serialization or in the transission. You can see this: try to deserialize your object just after you have serialized it (in the 'client') and before sending it. This will help to localize the bug. To give you an idea, the code follow. HTH (luKa) http://nullabletypes.sourceforge.net/ [nu.Test] public void SerializationTest() { NullableInt32 serializedDeserialized; serializedDeserialized = SerializeDeserialize(_null); nua.Assert("TestA#01", _null.Equals(serializedDeserialized)); } private NullableInt32 SerializeDeserialize(NullableInt32 x) { System.Runtime.Serialization.Formatters.Soap.SoapFormatter serializer = new System.Runtime.Serialization.Formatters.Soap.SoapFormatter(); using (sys.IO.MemoryStream stream = new sys.IO.MemoryStream()) { serializer.Serialize(stream, x); sys.Text.Decoder d = sys.Text.Encoding.Default.GetDecoder(); stream.Seek(0, sys.IO.SeekOrigin.Begin); // Return stream to start NullableInt32 y = (NullableInt32)serializer.Deserialize(stream); stream.Close(); return y; } } <[EMAIL PROTECTED]> wrote: >By fixing your programming error. > >At some point in the serialization/eserialization/transfer process you >seem to loose/chagne/gargabe the data. > >That simple. > >Sorry if this is not helpful, but with the innformation given this is >the only hadvice I can give you. Serialization DOES work, so you must do >something with the data on the transfer. > >Thomas Tomiczek >THONA Software & Consulting Ltd. >(Microsoft MVP C#/.NET) > >-Original Message- >Sent: Mittwoch, 29. Oktober 2003 06:34 >Subject: [ADVANCED-DOTNET] Serialization Problem > >I am serializing an object and sending it through networkstream to >another computer. However when i try to deserialize it, it is giving me >a error "BinaryFormatter Version incompatibility. Expected Version 1.0 >Recieved version 1566270836.0" > >I am using socket programming and not remoting. I am creating the >application on a stand alone machine having only one version of .NET >framework. >How can i resolve this error? > === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
[ADVANCED-DOTNET] DirectoryServices / Security issue?
I've an ASP.NET web server that impersonate's its clients. The web server tries to lookup an Active Directory property via DirectoryServices.DirectorySearch. The machine that the web server runs on is configured in Active Directory to allow credential delegation. I am looking for a certain user, and am searching by "sAMAccountName=XXX". When I run the web server on localhost (with browser client also on the same machine), I can find 'XXX' just find via DirectorySearcher.FindOne, and examine the property I'm interested in. For some reason, when I move my browser client to another machine, the DirectorySearcher.FindOne method returns null. I know the Directory entries are there. If I start a cmd prompt on the other machine and run the W2K LDP.EXE utility, I see the user and the properties I want. The LDAP / Active Directory server is the same -- just a pretty vanilla W2K Active Directory (*non* mixed mode). I've tried playing around with DirectoryEntry.AuthenticationType, setting it to Secure, as well as trying Secure | ServerBind | ReadonlyServer. No go -- still nothing found. I have confirmed in the debugger that the Thread Principal Identity is the browser client identity. I've tried clients as W2K3 Servers (actually a Terminal Services client onto a W2K3 Server, where the TS client is an XP box) as well as XP machines (no Terminal Services -- just straight connection to the web server). Is there some limitation between Impersonation and DirectoryServices? Thanks in advance, Howard Hoffman === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
Re: [ADVANCED-DOTNET] Serialization Problem
Before you deserialize, try dumping the information you receive to a trace log. In all cases where I have seen this, I have been receiving an error message of some kind instead of the serialized object. Then when the BinaryFormatter tries to deserialize the object, it incorrectly mistakes some text or corrupted data as a version number. Jerry Bullard Information Services & Technology Mary Kay, Inc. -Original Message- From: Andrew Gayter [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 1:50 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Serialization Problem It looks like you're either not serializing it correctly, or you're deserializing on a different machine? Change to a SOAP/XML formatter and dump the received stream to a file, or debug - check it out and make sure it's okay. > -Original Message- > From: Moderated discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of dotnetminer > Sent: 29 October 2003 05:34 > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Serialization Problem > > I am serializing an object and sending it through networkstream to another > computer. However when i try to deserialize it, it is giving me a > error "BinaryFormatter Version incompatibility. Expected Version 1.0 > Recieved version 1566270836.0" > > I am using socket programming and not remoting. I am creating the > application on a stand alone machine having only one version of .NET > framework. How can i resolve this error? > > === > This list is hosted by DevelopMentorR http://www.develop.com NEW! > ASP.NET courses you may be interested in: > > 2 Days of ASP.NET, 29 Sept 2003, in Redmond > http://www.develop.com/courses/2daspdotnet > > Guerrilla ASP.NET, 13 Oct 2003, in Boston > http://www.develop.com/courses/gaspdotnet > > View archives and manage your subscription(s) at > http://discuss.develop.com === This list is hosted by DevelopMentor(r) http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
[ADVANCED-DOTNET] Security Question: SSPI to validate user?
Is there a simple way to validate a user (e.g username and password) without getting a token back using SSPI? I know I can call the LogonUser API, but I just need to find out if the credentials are valid? Am I on the right track with SSPI? === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
Re: [ADVANCED-DOTNET] DirectoryServices / Security issue?
> For some reason, when I move my browser client to another machine, the > DirectorySearcher.FindOne method returns null. I know the Directory > entries are there. If I start a cmd prompt on the other machine and run > the W2K LDP.EXE utility, I see the user and the properties I want. If it works from one computer and not another, the first thing I would look at is if both are successfully authenticating with Kerberos authentication instead of NTLM. To access the AD as the impersonated user, the web server requires full network credentials. This can be supplied by basic auth, as both username and password are present, or by kerberos which will auththenticate behind the scenes using tokens. I would download Kerbtray from microsoft and compare your tickets. I have had some situations where we could not get kerberos to work, even though the environments seem the same. In some cases wiping out the users profile and starting over solved the problem, but that's not a very satisfying solution. === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
Re: [ADVANCED-DOTNET] DirectoryServices / Security issue?
It may be a CodeAccessSecurity issue. When you run as local host, you're in a different zone that on the other machine probably...but I would have expected a security error, not a NULL, but thought I'd throw a hint out in case. Thanks, Shawn Wildermuth [EMAIL PROTECTED] Author of Pragmatic ADO.NET http://adoguy.com/book http://ONDotnet.com Microsoft .NET MVP > -Original Message- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of > Howard Hoffman > Sent: Friday, October 31, 2003 4:55 PM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] DirectoryServices / Security issue? > > I've an ASP.NET web server that impersonate's its clients. > The web server tries to lookup an Active Directory property > via DirectoryServices.DirectorySearch. > > The machine that the web server runs on is configured in > Active Directory to allow credential delegation. > > I am looking for a certain user, and am searching by > "sAMAccountName=XXX". > When I run the web server on localhost (with browser client > also on the same machine), I can find 'XXX' just find via > DirectorySearcher.FindOne, and examine the property I'm interested in. > > For some reason, when I move my browser client to another > machine, the DirectorySearcher.FindOne method returns null. > I know the Directory entries are there. If I start a cmd > prompt on the other machine and run the W2K LDP.EXE utility, > I see the user and the properties I want. > > The LDAP / Active Directory server is the same -- just a > pretty vanilla W2K Active Directory (*non* mixed mode). > > > I've tried playing around with > DirectoryEntry.AuthenticationType, setting it to Secure, as > well as trying Secure | ServerBind | ReadonlyServer. > > No go -- still nothing found. I have confirmed in the > debugger that the Thread Principal Identity is the browser > client identity. > > I've tried clients as W2K3 Servers (actually a Terminal > Services client onto a W2K3 Server, where the TS client is an > XP box) as well as XP machines (no Terminal Services -- just > straight connection to the web server). > > Is there some limitation between Impersonation and DirectoryServices? > > Thanks in advance, > > Howard Hoffman > > === > This list is hosted by DevelopMentorR http://www.develop.com > > >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting > >>> command <<< > -> .NET courses you may be interested in: <- > --- > > --- === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
Re: [ADVANCED-DOTNET] Serialization Problem
Do you already look at this; http://www.ingorammer.com/RemotingFAQ/BINARYVERSIONMISMATCH.html ? bye (luKa) On Wed, 29 Oct 2003 00:34:29 -0500, dotnetminer <[EMAIL PROTECTED]> wrote: >I am serializing an object and sending it through networkstream to another >computer. However when i try to deserialize it, it is giving me a >error "BinaryFormatter Version incompatibility. Expected Version 1.0 >Recieved version 1566270836.0" > >I am using socket programming and not remoting. I am creating the >application on a stand alone machine having only one version of .NET >framework. >How can i resolve this error? > === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-
[ADVANCED-DOTNET] System.Reflection.EventInfo.GetRaiseMethod always returns null?
Using .NET 1.1 and C#, has anyone written code that successfully retrieves the MethodInfo from the EventInfo.GetRaiseMethod call? My type does includes a event declaration and ildasm reports it is a private field. The type retrieves the EventInfo and I can discover the Add/Remove methods correctly, but I always get null from the GetRaiseMethod(void or true or false). Also, no exception is ever throw. Any help is appreciated. Thanks, -Jeff WS === This list is hosted by DevelopMentor® http://www.develop.com >>> Error in line 16 of ADVANCED-DOTNET.MAILTPL: unknown formatting command <<< -> .NET courses you may be interested in: <-