ASP.NET C# Serialize HttpValueCollection?
Mar 31, 2011
I'm trying to serialize a Request object for logging purposes. The code
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(obj.GetType());
// obj is a Request object
gives me the following exception:To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.String) at all levels of their inheritance hierarchy. System.Web.HttpValueCollection does not implement Add(System.String).
View 2 Replies
Similar Messages:
Jan 25, 2010
Im using DataTable to write some XML. but i got Serialization problem. when i try write i got error message, your datatable is not serialize.(i dont want use DataSet)How i Serialize DataTable?
View 2 Replies
Mar 23, 2010
how we can serialize a datareader in webservices.
View 1 Replies
Mar 20, 2010
How to serialize the DataReader in webservices in asp.net?
View 4 Replies
Jun 14, 2010
I have a shared object through net remoting. The problem is that this object has some EntitySet and EntityRef attributes. When I try to run the program I get an exception telling me that EntitySet is not marked as Serializable. If I mark it as Serializable everything seems to be ok, but when I try to access from outsied to the attribute represented by the EntitySet, I am not able to use it.
BTW, Does anyone know how change the default binary serialization of tcp channel?
View 3 Replies
Jun 21, 2010
I have no problem getting a custom profile class to work as it should in Asp.Net MVC 2, C# -- as long as I am content that the profile info is serialized as xml.The question is how to get it to serialize as Binary, rather than xml -- Is that possible?in the web.config...
<profile defaultProvider="MIProvider" inherits="Models.MbrProfile" automaticSaveEnabled="false">
<providers>
<clear />
<add name="MIProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MIconnect" applicationName="myApp" />
[code]...
View 2 Replies
Feb 12, 2011
I am facing an critical problem in Enum serialization in WCF. Here is the scenario: I have an enum like this...
[Serializable] [DataContract(Namespace = "http://www.geniusdoc.portal.com/serivces/2011/v1/GdService", Name = "AppointmentMode")] public enum AppointmentMode : int { // 1: Email, 2: Phone [EnumMember(Value = "1")] None = 1, [EnumMember(Value = "2")] Email = 2, [EnumMember(Value = "3")] Phone = 3 }
Here I decorated each enum value with [EnumMember], so that I can use the Enum as Data Contract in WCF.
And, AppointmentMode will be saved as INTEGER in database. So I need to serialize this Enum to its value. So I have specified value to each member like... [EnumMember(Value = "1")]
Problems:
If I use the above code as it is...SvcUtil not considering Enum Text, and generating the Enum in Proxy as below...
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="AppointmentMode", Namespace="http://www.geniusdoc.portal.com/serivces/2011/v1/GdService")] public enum AppointmentMode: int { [System.Runtime.Serialization.EnumMemberAttribute(Value="1")] _1 = 1, [System.Runtime.Serialization.EnumMemberAttribute(Value="2")] _2 = 2, [System.Runtime.Serialization.EnumMemberAttribute(Value="3")] _3 = 3, }
If I remove the Value from [EnumMember(Value = "1")], while deserialization is considering Enum Text, and giving results as below
<AppointmentMode>None</AppointmentMode>
Expected result:
1. Enum in the Client proxy should be same original Enum.
2. Enum Deserialization should consider EnumValue, such a way that it will return
<AppointmentMode>1</AppointmentMode>
How to get this done?
View 5 Replies
Oct 13, 2010
Type 'System.Data.Linq.ChangeTracker+StandardChangeTracker' in Assembly 'System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable
have read all threads but still cant solve the error. I can do insert update and delete but dont know where exactly the error occurs and how??
View 1 Replies
Oct 21, 2010
i need to serialize and deserialize an image for my project. i have been googling it for a few days but i cannot find any VB codes related to image serialization... can someone give me some hints on how i should start?? for my program, i need to save the image to sql database and then i need to retrieve all the image for my product catalog
View 2 Replies
Jan 21, 2011
Currently I am working on SessionState with SQL. I have problem. I would like to serialize TreeNode. This TreeNode pbject will be assigned to Session and this is declare as below.
private _treeNode as TreeNode <-- member variable
how do I make this _treeNode seriablizable?
View 1 Replies
Jul 2, 2010
Is there any way or process to serialize the the objects?? i am trying to store the instance of few control in viewstate but it shows error msg that it is not a serialized object. should i perform some steps to serialize the objects ???
View 9 Replies
Feb 3, 2011
How do I get at the data after doing a .sortable serialize? Here is my code :
[Code]....
View 1 Replies
May 18, 2010
I am facing the problem while using For Xml'AddressLine' because it contains a character (0x000F) which is not allowed in XML I found some other similar charectors which is raising the exception.Using replace of such charectors results in loss of data Please give me a solution or any work around.
View 2 Replies
Feb 3, 2011
I'm learning ASP.NET MVC 2 I want to create a wizard-type application. I was reading you can accomplish this with the help of Html.Serialize method in ASP.NET MVC Futures assembly (To help preserve state as you step through views).
I haven't seen that this is even part of MVC 3.0 as well. how certain this feature will be included for sure in the future? I'm a little wary of relying on it being there.
View 2 Replies
Apr 14, 2010
Using the following code:
Private Sub MakeMeSomeXmlBeforeRyanGetsAngry()
Dim db As New MyDBDataContext
Dim customer = From c In db.Customers Select c
Dim dcs As New DataContractSerializer(GetType(Customer))
Dim sb As StringBuilder = New StringBuilder
Dim writer As XmlWriter = XmlWriter.Create(sb)
dcs.WriteObject(writer, customer)
Dim xml As String = sb.ToString
Response.Write(xml)
End Sub
I am attempting to serialize my linq collection of customers. But it keeps throwing
Type 'System.Data.Linq.DataQuery`1[MyDB.Customer]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
My issue is that I have already marked the dbml Serialization Mode to UniDirectional and when I check the dbml codebehind all of the DataContract()> and DataMember()> elements are there.
I am not sure how to proceed. I have tried adding various dataloadoptions and setting deferredloading to false, but no luck.
View 2 Replies
Sep 9, 2010
I am using Flexigrid in my project to add a button on the grid toolbar I can use code like this:
"buttons":[
{"name":"Modifica","bclass":"edit","onpress":"doCommand"},
{"name":"Elimina","bclass":"delete","onpress":"doCommand"}
],
Anyway the "onpress" attribute shall contain a reference to a js callback and so this field shall not be enclosed within quotation marks.
I am using the class JavaScriptSerializer (in the System.Web.Script.Serialization namespace) to do the serialization.
How I have to declare the variable to make JavaScriptSerializer serialize like this?
"buttons":[
{"name":"Modifica","bclass":"edit","onpress":doCommand},
{"name":"Elimina","bclass":"delete","onpress":doCommand}
],
View 3 Replies
Oct 1, 2010
I have a custom Javascript object that has a few string and float members. I'd like to serialize an array of them in Javascript, assign the result to a hidden field, and then retrieve and deserialize them in the codebehind for my asp.net application.
View 3 Replies
Mar 16, 2010
I am trying to serialize an object that has a public member of type ArrayList. If I am reading
this correctly, an ArrayList is a serializeable member. My class looks like this:
[DataContract(Name="Family")]
public class Family
{
private int _FamilyID;
[DataMember]
[Code]....
But then I'm serializing more of the properties than I want. I would be happy to either a) figure out how to get DataContractJsonSerializer to serialize my ArrayList or b) get JavaScriptSerializer to have the effect of honoring a datacontract. I understand that JavaScriptSerializer is depricated so I suppose DataContractJsonSerializer is the way to go if possible.
View 3 Replies
Dec 11, 2013
Getting error when trying to save structured arraylist into session Variable (see btnTS_Click below)
Code works on my desktop VS2012 devel system but not when posted to webserver we use.
Try It: [URL] ....
Code:
Public Class _Default
Inherits System.Web.UI.Page
Structure HoursData
Dim Project As String
[Code]...
View 9 Replies
Dec 22, 2010
am building jQuery UI sortable to store order in the database using serialize and ASP.NET Web Service. I know how to do it in php, but I am not sure how to do it in ASP.NET... I tried googling with little success.
$('#mylist').sortable({
handle: ".handle",
axis: "y",
[code]...
View 2 Replies
Jul 8, 2010
I'd like to serialize and deserialize an object using SilverLight.
View 2 Replies
Apr 1, 2010
I had an xml-serialization which worked fine, but as I have just knew it doesn't work in Opera browser. I think, it's security rules don't allow to write to cookies xml-content.What can I do? Can I use binary serialization or something else?
View 2 Replies
Jun 24, 2010
I get the usual system.outofmemoryexception with the code below.
Is there a way to do this in small chunks?
public static void Serialize(DataTable dt, string filename)
{
FileStream fs = new FileStream(filename, FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
try
{
bf.Serialize(fs, dt);
fs.Close();
}
catch (Exception)
{
fs.Close();
fs.Dispose();
File.Delete(filename);
}
}
View 3 Replies
Aug 6, 2010
Why to Serialize an object to store in ViewState?
View 1 Replies
Oct 14, 2010
We have been receiving reports of the following server error periodically from users.
[OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.]
[HttpException (0x80004005): Unable to serialize the session state.]
Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is "StateServer" or "SQLServer".
Once in a state where this error appears, it appears to be hit or miss whether the errors are reproducible locally. If they are, then we can usually reproduce them for a couple minutes, but not on every page hit. This usually tapers off on its own and usually has resolved itself by the time we get back in contact with the users. The Web Service has around 90-100 active connections during business hours. The only other site on this server is the staging version of this site, which gets hit very infrequently. The Session State is stored on the same SQLServer instance as the application database which is housed on a fairly large cluster of virtual machines.
Neither the Web Server or the SQLServer seemed to be taxed (either processor or memory-wise) while this is going on. The distribution of which pages are erroring seems to be comparable to the normal distribution for each page. There doesn't appear to be any pattern in terms of times of occurrence. We do have less errors on average on weekends (which correlates to normal site load), but even this appears to not be consistent. There also doesn't appear to be a correlation between the errors logged and any kind of logged performance monitor events. This includes an array of perfmon counters including:
.NET CLR Jit(w3wp)
otal # of IL Bytes Jitted
.NET CLR Jit(w3wp)IL Bytes Jitted / sec
.NET CLR Jit(w3wp)\% Time in Jit
.NET CLR Jit(w3wp)# of Methods Jitted
.NET CLR Jit(w3wp)# of IL Bytes Jitted
ASP.NET Apps v1.1.4322(__Total__)Requests Failed
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution/Sec
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution
ASP.NET Apps v1.1.4322(__Total__)Cache Total Turnover Rate
ASP.NET Apps v1.1.4322(__Total__)Errors During Preprocessing
ASP.NET Apps v1.1.4322(__Total__)Errors During Execution
ASP.NET Apps v1.1.4322(__Total__)Requests Executing
ASP.NET Apps v1.1.4322(__Total__)Requests Total
ASP.NET Apps v1.1.4322(__Total__)Errors Total
ASP.NET Apps v1.1.4322(__Total__)Sessions Abandoned
ASP.NET Apps v1.1.4322(__Total__)Errors Total/Sec
ASP.NET Apps v1.1.4322(__Total__)Anonymous Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Session SQL Server connections total
ASP.NET Apps v1.1.4322(__Total__)Cache Total Hit Ratio
ASP.NET v1.1.4322Requests Current
ASP.NET v1.1.4322Request Execution Time
MemoryPages/sec
Bytes Total/sec
PhysicalDisk(_Total)Avg. Disk Queue Length
Processor(_Total)\% Processor Time
Web Service CacheFile Cache Hits %
Web Service CacheFile Cache Misses
Web Service CacheFile Cache Hits
Web Service(_Total)Current Connections
Web Service(_Total)Post Requests/sec)
The only pattern I can see in the logs doesn't correlate to the occurrence of these errors, but is the only pattern I can see. Looking at the perfmon logs we are seeing a pattern where the "Total # of IL Bytes Jitted", "IL Bytes Jitted / sec", "% Time in Jit", "# of Methods Jitted", and "# of IL Bytes Jitted" counters for the staging site (which shouldn't be getting any traffic) doesn't pull data for a 20-50 minute period after which there is an immediate spike in "IL Bytes Jitted / sec" and a jump in "% Time in Jit" for 2-20 minute of up to 99% for the main site.
View 1 Replies