Security issue when add data through OData service

Topics: General
May 15, 2011 at 10:18 AM


I,ve get a forbidden error when I try to add new data through OData service. I use Wcf Data Services client.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Services.Client;
using CompositeC1DataContext = CompositeC1ManageOne.CompositeC1OData.Container;
using CompositeC1ManageOne.CompositeC1OData.NetNodeMap;
using System.Net;
namespace CompositeC1ManageOne
	public partial class Main : Form
		CompositeC1DataContext context;
		public Main()
		private void Main_Load(object sender, EventArgs e)
			context = new CompositeC1DataContext(new Uri(@""));
			context.Credentials = new NetworkCredential("admin""xxxxxxx");
		private void bCreate_Click(object sender, EventArgs e)
			fMessage.Text = "";
			var newLink = new NodeLink();
			newLink.Name = fName.Text;
			newLink.Description = fDescription.Text;
			newLink.Url = fUrl.Text;
			newLink.CreateDate = fDate.Value;
				fMessage.Text = context.SaveChanges().ToString();
			catch(Exception ex)
				fMessage.Text = ex.Message;

User "admin" is and administrator. 

When query data works fine.
Could you help me?

May 16, 2011 at 8:02 AM

Are you calling the implementation downloadable from ? This impl. is a demo that only implements parts of OData (no add or update features). We stopped at this point to get some feedback and see if anyone would use this - if you would like these features, please tell a little about your use case, we or someone can pick up the code and add more features.

Oct 18, 2011 at 12:33 AM

Hi there, my company would be very interested in a full working OData implementation. If there are no updates at this time we'll work on expanding it and contribute anything worthwhile back to the community. Cheers.

Oct 18, 2011 at 7:56 AM

That sounds fantastic! Thanks!

May 8, 2012 at 9:25 AM

Hi Mawtex

I'm developing 2 remote clients (desktop and mobile) that's the reason I asked about RemoteAPI. 
The secret was that I'm using MonoTouch and MonoForAndroid where WCF is not fully implemented. In the meantime we have
managed to prepare small OData client on mobile side so I do get pulled data, but I'd like to add some.

So few questions:

  • How far is insert/add functionality?
  • so only context.NetworkCredentials is needed to reuse CompositeC1 security stuff?




May 14, 2012 at 8:38 AM

Hi Mel,

the sample at is read only and you need to add your own security - no one have worked on this since the sample was made two years ago, so it's still pretty simple.