VB.NET - NetworkCredential to Serializable for StateServer
Asked By Wajeeh Khan
25-Oct-04 05:19 PM
I am useing StateServer for session but problem is I canot save NetWorkCredential object into session.
how I set that object into serializable.
thanks
show us the code including
the details of the exception that is thrown.
if it turns out that StateServer cannot serialize / deserialize the class instance, you can simply store the domain, userName and password properties and use them to reconstruct a new, identical NetworkCreedential object out of Session.
Error Detail
Here is the error but problem if I set any Binary object then I have same problem.
The type System.Net.NetworkCredential in Assembly System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable.
Here the code
Dim sw As New IO.MemoryStream
Dim b As New BinaryFormatter
b.Serialize(sw, SessionObject)
Session(SessionName) = sw.ToArray
Exactly as I thought!
NetworkCredential is not serializable, therefore the StateServer serialization framework is unable to put it into a format that can be stored and deserialized back into a NetworkCredential object when you request it back out.
Therefore, the simple solution, as stated, is to store the important PROPERTIES of the NetworkCredential object (userName, Password, Domain, etc) and when you need them back out, create a new instance of the NetworkCredential class and assign the retrieved property values back to it.
Any reason why this would be a problem?
What about User depend class or object
So that mean we canot save any object class into session if we useing stateserver?
What I said was that StateServer
can only save objects that are Serializable via one of the serialization classes (typically BinaryFormatter). Now one way around this is to build your own custom NetworkCredentials class possibly deriving it from NetworkCredentials, and marking your class a serializable.
All the NetworkCredentials class does is neatly package up and properly format the user, password and domain for authentication purposes, it has no other "magic" in it.
working on remote site I have the config below in my web.config <customErrors defaultRedirect = "error / error.aspx" mode = "On"> <error statusCode = "500" redirect = "error / error.aspx" / > <error statusCode = "404" redirect = "error / error.aspx" / > < / customErrors> I have changed the mode to RemoteOnly with no success Initially i didn
complete, as it keeps stopping. The only clue in the event log is a 5014 error - The DFS Replication service is stopping communication with partner <server> due to an error. The error in question is 1722 (The RPC Server is unavailable). If I restart the DFS service 4CA5-93D3-9923AC11D640} csName:Production updateType:remote 20081001 08:32:57.251 2748 DOWN 5186 [ERROR] DownstreamTransport::RdcGet Failed on connId:{F33E154B-B106-4CA5-93D3-9923AC11D640} csId:{81BF2885-1DE4-4F26-8E2B 00000000-00000000-00000000 + similarity 00000000-00000000-00000000-00000000 + name {066AED9B-313E-4D28-A0C6-4A144863E7C5}-v1075 + Error: + [Error:9027(0x2343) RpcFinalizeContext downstreamtransport.cpp:1096 2748 C A failure was reported by the remote partner] + [Error:9027(0x2343) DownstreamTransport::RdcGet downstreamtransport.cpp:5124 2748 C A failure was reported by the remote partner] + [Error:170(0xaa) DownstreamTransport::RdcGet downstreamtransport.cpp:5124 2748 W The requested resource is in use
Reserved error (Error 3000) DataBase Does anyone know what is causing this error? Reserved error <Item> ; there is no message for this error. (Error 3000) An unexpected error occurred. The specified code identifies the conditions under which this error can occur. Please contact Microsoft Product Support Services for more information. Here's SQL: INSERT
Mapping .NET Framework Hello, I am mapping a class Error to another class YError: YError ToY(Error error) { return new YError { Id = error.ErrorId, CreatedAt = error.CreatedAt, Description = error.Description, HttpCode = error.HttpCode, }; } / / ToY Now I am trying a new version that does the mapping for many errors: IQueryable<YError> ToY(IQueryable<Error> error) { return error.Select(e = > e = <YError> ToY(error)).AsQueryable(); } / / ToY But I get the