C# - Bypass Non Serializable Properties When Going About Serialization

Nov 12, 2010

I follow the code snippet to calculate Session size. Profile Memory Usage of Session State ASP.Net My problem is some properties of objects aren't marked as Serializable so I cannot apply the solution. Can I just bypass non-serializable properties?

View 1 Replies


Similar Messages:

Web Forms :: Soap Serialization And C# Automatic Properties?

Oct 11, 2010

if I serialize C# automatic properties with soap serialization, generated xml contains ugly element namesfor City property it is <_x003C_City_x003E_k__BackingField id="ref-6">I know that it is because it doesn`t serialize property but generated variable that may have such name.

View 4 Replies

DataRows Not Serializable In 2.0

Mar 14, 2011

My application uses DataRows and they are not serializable. Is there any workaround for the same?

View 1 Replies

C# - Check Whether A Instance Is Serializable?

Nov 12, 2010

How can check whether a instance is marked as serializable?

View 4 Replies

Determine Which Classes Are Serializable?

Aug 16, 2010

I am changing my ASP.NET app to use a web farm. To do this, I need to change the session state from in-proc to a State Server. To do this, it is my understanding that the classes that are used must be marked as serializable. How can you tell if that is possible with a class? Will you get an error at compile time if it is not possible?

View 2 Replies

Return Serializable Object From FileStream?

Dec 30, 2010

I'm a little green when it comes to streaming and serialization...but what i wanna do is make the Upload method on the server return a serializable object to the client (it is void right now). I have a public class ServiceResult that i decorate with [Serializable], and a public class FileTransferService that implements IFileTransferService

[ServiceContract()]
public interface IFileTransferService
{
[OperationContract(IsOneWay = false)]
string Upload(FileTransferRequest request);
}
The implementation does its thing, and then at the end i create and serialize the object and try to return the string
return ServiceResultSerializer.SerializeAnObject(result);
On the client side i call this service using this class
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IFileTransferService")]
public interface IFileTransferService
{
// CODEGEN: Generating message contract since the wrapper name (FileTransferRequest) of message FileTransferRequest does not match the default value (Upload)
[System.ServiceModel.OperationContractAttribute(IsOneWay = false, Action = "http://tempuri.org/IFileTransferService/Upload")]
string Upload(FileTransferRequest request);
}

I'm basically taking this project found on this blog: [URL] And trying to make it return a value that the client caller can use I get an error right now that says: The operation 'Upload' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters. Which i have no idea what it means :P I think cuz im trying to change the Service paramaters.

View 1 Replies

C# - Object Serializable For AJAX - WCF And ViewState

Jun 30, 2010

consider the following class and struct

public class Entity {
public IdType Id {get;set;}
public string Data {get;set;}
}
[TypeConverter(IdTypeConverter))]
public struct IdType {
... any data ...
}

The IdTypeConverter can convert the IdType struct from and to string. Now, what I want is this class to be serializable for AJAX, WCF and ViewState. The senario could be a WCF web service which provides as array of Entity[] to a DataSource. And a custom control which binds to the datasource, saves this class to it's ViewState and sends the data to client side code. This could be achieved easily by simply adding a [Serializable] attribute to all serialized types. But I don't want the IdType to be serialized, but to be converted to a string. Thus the JSON representation should be

{ 'Id'=>'StringRepresentationOfId', 'Data'=>'foo' }

This would analogously be the optimal serialization for WCF and ViewState. Another solution would be to write another class

public class JsonEntity {
public JsonEntity(Entity from) {
Id = from.Id;
Data = from.Data;
}
public string Id {get;set;}
public string Data {get;set;}
}

and use this for JsonSerialization. But I don't like this, because this would imply that the control which is sending the data to the client knows about the Entity type. The actual question is: Is it possible to customize JsonSerialization with attributes without breaking WCF and ViewState serialization? DIT: An answer like "That' impossible" would satify me, since I'd stop trying.

View 2 Replies

C# - Mark A Property As Non Serializable For Json?

Feb 24, 2011

As the title says, I want to mark a property as non serializable by the JavascriptSerializer. How can achive that ?

View 1 Replies

C# - To Be XML Serializable, Types Which Inherit From ICollection Must Have An Implementation Of Add?

Nov 10, 2010

I have CSLA (1.x framework) objects from an existing project that I'm trying to use in a new .Net 4.0 project. The objects are being used in production and I really can't convert them to 2.x or EF without having 2 sets of objects.

In my c# webservice (when I try to run it) I am getting the following error:

To be XML serializable, types which inherit from ICollection must have an implementation of Add(objectname.object) at all levels of their inheritance hierarchy. objectname.objectList does not
implement Add(objectname.object).

Like I said these objects are CSLA objects written in vb.net. I don't know where to look on this one. Is it an issue of .Net 4.0 trying to talk to CSLA 1.x or is it a web service issue (as these objects never used web services originally)?

Does anyone have an idea about where I should look to figure out this issue? Should I suggest converting to CSLA 2.x?

View 1 Replies

C# - Check Compile Time That Type Is Marked With The Serializable Attribute?

Jan 26, 2011

Specifically we're making our application compatible with the Out Of Process Session State server where all types saved in session must be serializable. Is there a way to see at compile time that any type put into HttpSessionState is marked with the Serializable attribute. Something along the lines of this 'non-valid' code

public static void Put<T>( string key, T value ) where T : IsMarkedWitheSerializableAttribute
{
HttpContext.Current.Session[key] = value;
}

View 2 Replies

Crystal Reports :: How To Bypass This

Aug 30, 2010

[IMG]http://i35.tinypic.com/2nv7zbt.jpg[/IMG]my connection is on server which is on remote(on other system)everytime when i try to get the data from the remote server it asks me password is there a way i can stop or by pass it from askiing to me again and againg

View 2 Replies

Bypass Data Annotations Validation On MVC 2?

Aug 4, 2010

I would like to know if it's possible to bypass the validation of one property which is using Data Annotations. Since I use the model across multiple pages, there's a check I need in some, but not in others, so I would like it to be ignored.

View 2 Replies

Bypass Existing HttpModule For A Http Handler?

Aug 11, 2010

Scenario: I have a bunch of web applications for which I want to add a simple ping functionality via http handler. Example: [URL]

Problem: For some of the applications this approach does not work becasue of custom HttpModule. These modules have some depedency on either authentication or some other processing logic due to which it makes the request invalid.

I am trying to find a solution to get this ping functionality work without making any changes to existing HttpModules.

View 2 Replies

C# - Bypass ConfirmButtonExtender Depending On Value Of Another Field In Page

Jan 19, 2010

I am trying to bypass the ConfirmButtonExtender depending on the value of another field in the page. Basically, when a user click on my "Cancel" button, I normally display a modalpopup using the confirmbuttonextender and the modalpopupextender to display a dialog box confirming that they wish to cancel any changes they have made and return to the prior screen. If they click Yes, the button's onclick event fires which calls some code in the codebehind and redirects the user to another page. If they click no, it just returns to the same page, with no changes. However, in some situations, I know that my user is unable to perform any edits (they aren't allowed to) and for those users, I don't want to display the "Are you sure you want to leave you will loose any changes" dialog box. I've set a hidden checkbox field named "cbAllowEdit" to indicate whether the user is allowed to edit the fields or not. I was trying to use the technique found at link text to get this working but it just doesn't even seem to be firing the button's onclientclick event at all.

ASPX & Javascript
<asp:CheckBox ID="cbAllowEdit" runat="server" Checked="true" />
<asp:Button ID="btnCancel" runat="server" CausesValidation="false"
OnClick="btnCancel_Click" Text="Cancel" OnClientClick="disableSubmit();return false;" />
<ajaxToolKit:ConfirmButtonExtender ID="ConfirmButtonExtenderbtnCancel"
runat="server" DisplayModalPopupID="ModalPopupExtenderbtnCancel"
TargetControlID="btnCancel" BehaviorID="ConfirmButtonExtenderbtnCancel" />
<ajaxToolKit:ModalPopupExtender ID="ModalPopupExtenderbtnCancel" runat="server"
BackgroundCssClass="modalBackground" CancelControlID="btnCancelCancel"
OkControlID="btnConfirmCancel" PopupControlID="ConfirmCancelPanel"
TargetControlID="btnCancel" />
<asp:Panel ID="ConfirmCancelPanel" runat="server" CssClass="modalWindow"
Height="200" Width="450">
<p class="confirmMessage">
Are you sure you want to navigate away from this record?
</p>
<div align="center">
<p class="feedbackError">If you have made any changes to the record since the last time
you saved, they will be lost.</p>
<asp:Button ID="btnConfirmCancel" runat="server" Text="Yes" Width="75" />
<asp:Button ID="btnCancelCancel" runat="server" Text="No" Width="75" />
</div>
</asp:Panel>
<script type="text/javascript">
function disableSubmit() {
if (document.getElementById('<%= cbAllowEdit.ClientID %>').checked) {
return checkSubmit();
}
else {
return true;
}
}
function checkSubmit() {
var confirmButton = $find('ConfirmButtonExtenderbtnCancel');
confirmButton._displayConfirmDialog();
}
</script>

Code behind:

/// <summary>
/// Runs when the btnCancel button is clicked.
/// </summary>
protected void btnCancel_Click(object sender, EventArgs e)
{
Page.Response.Redirect("~/Searches/LookupCode/Default.aspx");
}

View 2 Replies

State Management :: Bypass Second Login Module?

May 5, 2010

I am updating a website for a client. I am adding a module to it which uses the same username and password as the main site and has a link on the main admin page. But has a different admin page. I was wondering if I could use a session state variable to let the client automatically login to the module if he is already logged in to the admin page and how would I go about it?Secondly,I have 4 master pages setup. Two for the main website and Two for the module inside the website. Since the module is a separate app. Is there a way I can still nest the master pages to give the module a same look as the website. Other than creatings separate css files and then restarting the whole procedure.I get this error " The virtual path '/Website/MasterPage.master' maps to another application, which is not allowed."

View 1 Replies

Web Forms :: HttpWebRequest Bypass Javascript Redirection?

Feb 20, 2010

I just wonder if there is a way HttpWebRequest can bypass redirection made by javascript?For example, I use HttpWebRequest to hit [URL]

[Code]....

Instead of getting redirected to the page: http://office.microsoft.com/en-us/default.aspx, with http return code of 302 before the redirect.I got the html of the page, with <noscript> part of: If this page does not automatically redirect, you have scripts disabled. The http return code was 200.I know that the reason why HttpWebRequest does not handle the redirect is because it does not execute scripts like a browser. So I just wonder if there is a way to do this without using a browser?

View 3 Replies

Security :: Bypass Login Control And Set MembershipUser?

Feb 10, 2011

Before spening anymore time researching this, I'd like some opinions.I inherited a .Net application - and I won't even mention that the previous owner built it using inline code and removed the code behind pages - so I have a LOT of fixing to do, including adding a data access layer.But, there is a login control and this sets the MembershipUser.There is a second app, written in ColdFusion, that I am passing one variable to the .Net app.We need one login for both apps. So, the CF is logged in and goes to the .Net app.I can check this var and see if the user exists but need to log the user in and set roles and Membership but bypass the login of the login control.

View 2 Replies

Allow Japanese Characters To Bypass C#s HtmlEncode Method?

Apr 4, 2011

I need to scrub data for malicious content in a form (whose website is UTF-8 encoded) so I'm doing the following:

myTextBox.Value = System.Web.HttpUtility.HtmlEncode(value); where value is the data to be placed in the TextBox.This does correctly scrub malicious data such as Javascript calls, but also turns Japanese characters into their UTF-8 equivalents, such as &#24859;

Is there a way to skip those characters from being encoded, like some sort of range?

View 1 Replies

Web Forms :: Bypass The Textbox Textchanged Event On The Serverside?

Jan 20, 2010

i have a gridview with commandbutton column and a textbox template column. My requirement is changing the text and hitting the enter key should also perform the same function as the command button. So i enabled the autopostback of the textbox.But if i click the command button after changing the text in the text box fires both the TextChanged event as well as the item command event. Is there anyway to bypass the Textbox text change event if i postback using the grid command button?

View 2 Replies

How To Bypass OnSubmit Form Validation In ASPX Page

May 11, 2010

i have a form on a particular ASPX page that has custom js validation. Also on this form is a navigation menu in the header.

The navigation menu items are built programatically and are initiated by __doPostBack calls which obviously submits the form.

The problem i am having is that the form itself has code something like the following

onsubmit='return validateForm()'

and if the form has not been filled out then the form cant submit. This in itself is not a problem unless a user goes to the form but decides to navigate away.

When this happens the validateForm function fails.

Does anyone have a workaround for this issue?

NB: On my nav links i have already set CausesValidation="False"

This is the markup:

<div id="divNavigate" class="absolute_topleft">
<asp:LinkButton ID="linkGoHome" runat="server" OnClick="linkGoHome_Click" CausesValidation="false" CssClass="xxx">text.</asp:LinkButton>
</div>

This is the handler:

protected void linkGoHome_Click(object sender, EventArgs e)
{
Response.Redirect("xxxxx");
}

This is the validation function:

[Code]....

And this is how its called:

<form id="formLogin" runat="server" onsubmit="return validateTextField(field1)">

View 1 Replies

Bypass The X-Frame-Options: SAMEORIGIN HTTP Header?

May 6, 2010

I am developing a web page that needs to display, in an iframe, a report served by another company's SharePoint server. They are fine with this. The page we're trying to render in the iframe is giving us X-Frame-Options: SAMEORIGIN which causes the browser (at least IE8) to refuse to render the content in a frame. First, is this something they can control or is it something SharePoint just does by default? If I ask them to turn this off, could they even do it? Second, can I do something to tell the browser to ignore this http header and just render the frame?

View 1 Replies

Forms Data Controls :: Grouping Rows Gridview - Bypass Groupheader?

Dec 12, 2010

I used the gridviewhelper to group the rows in a gridview.

[Code]....

Each row as two itemtemplate, each one with a checkbox.

[Code]....

I'm having some problems when i search for the rows that have a checkbox checked.

[Code]....

I see when debugging, that for some reason the checkbox is checked in the row that have the groupheader, and then, in the row that is effectibly selected, the checkbox is not checked. So, in few words, how can i bypass the groupheader row and only search the checkboxes in the other rows.

View 2 Replies

Web Forms :: Properties Folder / Properties Changed No Settings Tab?

Nov 3, 2010

I have a new VS2010 .NET 4.0 Web project and the Properties Folder has gone wierd on me. It has lost teh "Open" under the right click. There is no way to get a Settings file created now.

I am unable to get to the Settings grid and no Settings file is created. I tried the help and it has the normal trip of select Properties, Open (right click), Settings Tab, etc. etc.

View 1 Replies

Active Directory/LDAP :: Use Membership But Bypass / Disable Password Usage For Users?

Aug 12, 2010

I have an application that does LDAP authentication. The authentication is done on the code behind page of my Login.aspx page. Once the user passes LDAP authentication, a cookie is set and I redirect:

FormsAuthentication.RedirectFromLoginPage(UserName.Text, False)

I would like to setup membership in my application and keep track of some user information. But due to company security requirements, I cannot store user passwords on my application. That must stay on the LDAP server only.Is there a way to store users but disable password storage on the aspnet_membership table?

View 2 Replies

Serialization In WCF Using JQuery?

Apr 26, 2010

is it possible to use WCF classes with attributes (like [DataMember....) then you wouldnt need to do seralization on the client side (jquery) ?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved