.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

DataContractSerializer do not verify "xml markup name" / "property name" correspondance

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
Hello, I use the DataContractSerializer o serialize / deserialize a complex class. During deserialisation, if an XML markup does not correspond to any property of my class, or if a property of the class is not present in the XML, there is not a single warning. This is problematic if a user make an invalid modification in the xml, or if a developer make a refactor in the code... How can I change this behavior ?   Thanks for your time.

View Complete Post

More Related Resource Links

The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that

Hi; I'm new to WPF and I was going through the ExpenseIt tutorial on MSDN's website. The tutorial was working fine until I added DataGrid. I got the error message: "The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."     I could not find a clear answer online of which assembly references to fix and how to fix them. Any help would be appreciated. Thanks!     Note: I'm running the following: Windows Vista 32-bit operating system Microsoft Visual Studio 2008 Version 9.0.30729.1 SP Microsoft .NET Framework Version 3.5 SP1

DataContractSerializer deserialization puzzle - by-pass member initialization.

Hi, I was using WCF and during the transmission of a object, of the type Book, see code below, the deserialization process throws a NullReferenceException. To isolate the problem, I uses a unit test like this rather than involving the full blown WCF marshalling. This appears to be solely a serialization/deserialization problem and has nothing to do with the communication issues in WCF. [Test] public void TestSerializeAndDeserializeBook() {     Book book = new Book( "Testing Serialization and Deserialization",                         new Person( 100, "Tom", "Smith" ),                         new Person( 101, "Peter", "Pan" ) );     DataContractSerializer ser = new DataContractSerializer( typeof(Book) );     using( Stream stm = new MemoryStream() )     {         ser.WriteObject( stm, book );         stm.Seek( 0, SeekOrigin.Begin );         Book regen = ser.ReadObject( stm ) as Book; // NullReferenceException here     &nb

How to make the Property Name and Type readonly for a PropertyEditor ?

Hi As part of my project I am using a custom PropertyEditor, which is inherited from  DialogPropertyValueEditor and overriden the ShowDialog method. As an Input, I am providing a Dictionary<string, InArgument> to the property editor. The property editor is openning properly and I am able to provide values for various properties in the Editor. But, the editor is allowing to change the Property name and Type. How can we make the property name and type readonly ? Regards Ambily IT Analyst DialogPropertyValueEditor

The report server is not responding. Verify that the report server is running and can be accessed fr

When I trying to configure Reposrting services in IIS & XP. It hsows me error  "The report server is not responding. Verify that the report server is running and can be accessed from this computer."   I also configure with reposrting configuration tools which show all confuguration is perfect.   but when I try to open through IE http://localhost/Reports/Pages/Folder.aspx   or http://localhost/Reportserver   It shows error. I try all ways still not works ..Help me out   Thanks.

The type 'DropShadowEffect' was not found. Verify that you are not missing an assembly reference a

We created a grid in Expressions Blend but the DropShadowEffect caused an error for a developer who tried to build the solution and did not have Expressions Blend on his machine.  Had to replace with  <Border.BitmapEffect><DropShadowBitMapEffect ... Are there other incompatibilities between Expressions Blend and plain old Visual Studio 2008 development environs? <   UserControl   xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation   xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml   xmlns:d=http://schemas.microsoft.com/expression/blend/2008   xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006   mc:Ignorable="d"   xmlns:igRibbon=http://infragistics.com/Ribbon   x:Class="TestEditor.Ctrl_PR"   x:Name="UserControl"   MaxWidth="450"   d:DesignWidth="450" d:DesignHeight="125">     <Grid x:Name="LayoutRoot" RenderTransformOrigin="0.5,0.5" Width="450" Height="125">   <Border CornerRadius="8" BorderBrush="DarkSlateBlue" BorderThickness="0.5" HorizontalAlignment="Stretch" Grid.ColumnSpan="2">     <Border.Background>       <LinearGradientB

Security Context Token verification failed. (The security protocol cannot verify the incoming messag

Hello, I would like implement Message Lever security with username/password authentication on HTTP. My environment looks something like this.  Server Side - Message lever security is configured on service.           <security mode="Message">             <message clientCredentialType="UserName" negotiateServiceCredential="True"/>           </security> - CA and self signed certificates are created on server and configured. ServiceCredentials are looks like this <serviceCredentials> <serviceCertificate findValue="CertForIdm" storeLocation="LocalMachine" storeName="My" x509FindType="FindByIssuerName" /> <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="IfMembershipProvider" /> </serviceCredentials> Client Side (References are generated by VS) - Binding configuration                 <binding name="WSHttpBinding_IWaypoint2" closeTimeout="00:11:00"                     openTimeout="00:11:00" receiveTimeout="00:10:00" sendTimeout="00:11:00"  &nb

Problem in verify data via SQL

I am facing problem in verify a registered user. The program can only read the first row table data. For example, the row 1 username is A, password is a, the row 2 username is B, the password is b, if I login via username A i can enter the system, but if I login via username B, the program cannot verify the username B. Here are my codes....Can anyone tell me what's going on?private bool YourValidationFunction(string UserName, string Password)    {        bool boolReturnValue = false;        string strConnection = @"Data Source=MY-PC;Initial Catalog=myDB.MDF;Integrated Security=True";        SqlConnection sqlConnection = new SqlConnection(strConnection);        String SQLQuery = "SELECT psw, userID, usertype FROM dbo.users_login";        SqlCommand command = new SqlCommand(SQLQuery, sqlConnection);        SqlDataReader Dr;        sqlConnection.Open();        Dr = command.ExecuteReader();        while (Dr.Read())        {            if ((Login1

Retrieve attribute with property name

What is the best way to obtain an attribute such as the DisplayNameAttribute of a model's property using the property's name. I am using the following method currently:((System.ComponentModel.DisplayNameAttribute)typeof(MyApp.Models.ModelFoo).GetProperty("Foo").GetCustomAttributes(typeof(System.ComponentModel.DisplayNameAttribute), true)[0]).DisplayName Looking at this long statement, I cannot help wondering if there is a better way to do it.

How to: Verify That Strings Are in Valid E-Mail Format

This is HALF answered in the MSDN library with an example function called IsValidEmail. Does anyone else think maybe it's time the example function (which developers are likely to copy-paste) was changed to closer represented what an email address can actually be? Sure, it matches joe.blogs@example.com, or joe-blogs@example.com... But how about joe.blogs+work@example.com, or joe.blogs+support@example.com, or e=mc^2@example.com, or many other valid email addresses? The page http://msdn.microsoft.com/en-us/library/01escwtf.aspx has been updated for each new release of VisualStudio/.NET, but even the VS 2010/.NET4.0 one isn't much better!

xml nodes query on DataContractSerializer string

Hi I need to get a table from this xml, I have some experience using nodes but am getting nowhere on this string.  It is produced from DataContractSerializer on a list with one of the columns a dictionary.  Any help will be much appreciated!  declare @xml xml = ' <ArrayOfArmorDeviceBase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://server.armor.com/contract/data">   <ArmorDeviceBase xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1" i:type="ArmorSimpleDevice">     <Id>5000</Id>     <SiteId>0</SiteId>     <SourceSystem>Armor</SourceSystem>     <DataGroups xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">       <d3p1:KeyValueOfstringDeviceDataGroupBaseRRFhSxY9>         <d3p1:Key>CommunicationStatus</d3p1:Key>         <d3p1:Value xmlns:d5p1="http://server.armor.com/contract/data/ControllerStatus" i:type="d5p1:CommunicationStatus">           <Ticks>0</Ticks>           <d5p1:Status>Disco

sqmapi.dll. Verify that the file exists and that you can access it.

I'm getting the following error when I try to install SQL Server 2008 on Windows Server 2008.  I looked under the following directory to make sure the file wasn't missing.  It is definitely there.  So I'm not sure why I'm getting the error.This is a remote server so I had to mount an ISO to install it.  Any thoughts on this.  I'd like to start using these products.  At this point I can't even install SQL Server 2008.Thanks,JimTITLE: Microsoft SQL Server 2008 Setup------------------------------ The following error has occurred: Error reading from file F:\x86\setup\sql_common_core_msi\PFiles\SqlServr\100\Tools\Binn\VSShell\Common7\IDE\sqmapi.dll.  Verify that the file exists and that you can access it. Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup. For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1600.22&EvtType=0xF45F6601%25401201%25401 ------------------------------BUTTONS: &RetryCancel------------------------------

Installer to verify and install multiple versions of .NET (3.5 SP1 and 4.0)

I'm running VS2010 and have built an installer that checks for the .NET 4.0 dependency. If the installer can't find .NET 4.0, then it is installed from disk (my client machines are not connected to the internet). However, I also require .NET 3.5 SP1 to be installed. Although both .NET 4.0 and 3.5SP1 are both checked in the "Prerequisites" box within my installer. Only .NET 4.0 shows up in the Launch Conditions panel. Right clicking on the "Requirements on Target Machine" box shows a fly out with several options but the "add .NET Framework Launch Condition" is grayed out, because one already exists. Any ideas?

The Web application at http://Sitename// could not be found. Verify that you have typed the URL corr

The Web application at http://Sitename/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Linq to SQL - Association Property Name problem

Is it possible to specifiy a custom property name for a foreign key association in Linq to Sql? For example, if you have an "Order" class that has a "Customer" EntityRef, that's fine.  But what if instead of myOrder.Customer you wanted the property name to be myOrder.PreferredCustomer.sqlmetal and the designer are both always using the table name as the Property name.  So myOrder.Customer is the only option I have, other than hacking through the generated file.You can change the storage option of the association attribute, but that pertains to the underlying member, NOT the public property.Thanks.

Verify .NET Installation & Configuration in Windows 7

I've posted in another forum but I thought it may be more appropriate here. I'm having a problem with getting a third-party application to work correctly with Outlook 2007; Outlook crashes or hangs when we activate/load this app.  I've sent information to the vendor (including .DMP of the crashed/hung process) and their response was that there was a problem with .NET on our machines.  I've done what I can but the problem persists. Is there anyway for me to validate 100%, without a shadow of a doubt, that our installation/configuration of .NET is correct? Can someone give me some tips/guidance/advice on how to use DebugDiag and WinDBG to further validate or disprove their claim? For more verbose information, please see my post here: http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/eac47204-3b91-4727-92a9-610e906543c1

"Could not verify the form template on the specified server" problem

I have an InfoPath 2010 form that I'm trying to publish as a browser-based form to a SharePoint 2010 Form Library.   It passes the compatibility checker if the "Verify on server" box is not marked, but will not validate on the server, giving only the message: Could not verify the form template on the specified server: http://portal.mydomainname.com/_vti_bin/FormsServices.asmx Make sure you are connected to the network and have access to the server. Browsing to the above URL brings up the FormsServicesWebService page just fine. The "portal.mydomainname.com" is in the Default zone.  Authentication provider for the Default zone is Windows NTLM with Client Integration enabled.  The server is registered with an enterprise key.  Forms Services is configured to allow browser-enabled forms. Any other ideas? Thanks -BobBob

HOWTO: Verify that custom error handling solutions do not expose padding oracle


I've done some digging and come up with what I think is useful information for you if you have a custom error handling solution in place instead of or as well as the usual ASP.NET <customErrors> stuff.

From comments on ScottGu's post it seem to be that the main suspect to be the actual padding oracle is WebResource.axd (possibly other axd's).

  • If you look in .NET Reflector at the IHttpHandler.ProcessRequest method in  System.Web.Handlers.AssemblyResourceLoader there's a call to Page.DecryptString early on.
  • This is the thing that will cause a HTTP 500 status to be returned if it fails, e.g. if the padding, etc in Request.QueryString["d"] is invalid
  • If the attacker manages to get the padding right, then it continues on, ultimately to call throw new HttpException(404...)

It's this differentiation: is the padding correct (404) or not (500) that is at the root of the exploit: the padding oracle.

If your error handling returns exactly the same response for both - it masks the oracle. To test if you're vulnerable externally, a simple test is to request both:

  • webresource.axd?d=foo
  • webre
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend