.net

How do I catch HTTP errors when using WCF's WebGet attribute?

I'm using the [WebGet] attribute to query a REST API on a web server. Every so often (because the API is still under development) I get back an HTML document in the form of an HTTP/500 error instead of the XML I want. Here's an example of my operation contract: [WebGet(UriTemplate = "search/?api_key={key}&query={query}", BodyStyle =...

Interop problem- - Different C# structure for different OS Architecture

I have a C++ structure, and I have to interop it from my C# code. I compile my C# code as a platform agnostic dll, which means that I can use the same C# dll on different platforms ( 32bit or 64bit-- doesn't matter), whereas I distribute the C++ differently for different platforms. The problem is that the C++ structure that I must int...

I've decoupled my user model from the main domain model that represents a 'person' and wonder how to retrieve personalized user data in the controller context.

Example: [Authorize] public ActionResult Index() { var person = _userPersonalizationService.GetPersonForUser(User.Identity.Name); var campaigns = _campaignRepository.GetCampaignsByCompanyId(person.Company.CompanyId); return View(campaigns); } Basically every user is tied to a person model, and in this instance, I want the ...

multiple delegate, attached and one fails...

Hi, I am having a scenario, in which i have multiple delegates attached to the event (multicast delegate). What could be the sequence of calling these methods/delegates (if any) ??? In case one of the method attached with the delegate throws the exception. Will the event stop processing further...??? Will the rest of the methods att...

Federated security scenario with HTTPS

I'm planning to build a set of web services which are going to use geneva-based custom STS to authenticate users. Both STS and relying services will belong to the same party, so the whole goal of going to federated security is providing Single Sign-On point and retrieving all the authorization information only once. Both STS and relying ...

Using adplus on a client pc, without admin rights

Is it possible to install and run adplus on a pc without being administrator? I want to investigate the memory usage of my winforms .net app on some users pc's but the users don't have administrator rights. I have tried to copy the whole debugging tools for windows folder to the pc, but adplus just exits with a warning about symbol path ...

best way to display search results on the same page as the search control in ASP.Net

I have two controls on a page, one is a search entry and submission control the other is the search results control, they have to be separated due to the layout of the site. Im looking at different ways of having the search control submit displaying the search results in the results control, initially im not bother about postbacks, im mo...

Best way to load large amouts of data into datagrid.

I am trying to load a lot of data into a datagrid which as you would expect takes a long time to load up. This is due to the face that I am loading data from a COM object which I have wrapped up into .NET object with a custom enumerator. I have looked into virtual loading the datagrid and it works alright but I was wondering if there w...

What are the reasons to use build scripts and continuous integration?

I'm trying to grasp the idea with build scripts, nightly builds and technologies like continuous integration, but I fail to see the advantages. Take this as an example: We are a 4-person team developing an application, without unit tests. We also use Subversion for source control. What benefits do we get by using custom build scripts a...

Find a key in a dictionary using IEqualityComparer

I have a Dictionary called AvailableBoxes. I want to lookup a string in this dictionary. However, I want to compare lowercase (and ignore special chars). I found out that I can do the following to know if the key exists in the dictionary: AvailableBoxes.Keys.Contains(CurrentBox.Name, new BoxNameEqualityComparer()) BoxNameEqualityComp...

Is there a way of setting a property once only in C#

I'm looking for a way to allow a property in a C# object to be set once only. It's easy to write the code to do this, but I would rather use a standard mechanism if one exists. public OneShot<int> SetOnceProperty { get; set; } What I want to happen is that the property can be set if it is not already set, but throw an exception if it...

The remote server returned an error: (422)

I am getting following error when I am trying to get WebResponse usiing WebResponse response = request.GetResponse() The remote server returned an error: (422). at System.Net.HttpWebRequest.GetResponse() at HopSharp.HoptoadClient.Send(HoptoadNotice notice) in D:\Projects\...dClient.cs:line 65 Does anyone have idea about this exc...

Reuse path object in XAML

Hi all, I have a Path (a star figure): <Path x:Name="NiceStar" StrokeThickness="10" Stroke="#ff000000" StrokeMiterLimit="1" Data="F1 M 126.578613,11.297852 L 162.373535,83.825684 L 242.412598,95.456055 L 184.495605,151.911133 L 198.167480,231.626953 L 126.578613,193.990234 L 54.988770,231.626953 L 68.661621,151.911133 L 10.744629,95.45...

Configuration files per assembly

Is it possible to use the .NET configuration objects to get at .config files specified for a class library assembly rather than the executable assembly. For example: I'm working on a .net port of Concordion and I would like to have options that are specific to Concordion itself but there are also options that are specific to each speci...

what is the best way to deserialize array of json objects without asp.net?

what is the best way to deserialize array of json objects without asp.net? Json format: {"results" : [ { "a": "value A", "b": "value B"}, { "c": "value C", "d": "value D"}]} Please note: Json object should be deserialized into .Net object. ...

Timer in Silverlight

Is there another Timer object that can be used in Silverlight except for the System.Threading.Timer object? ...

HttpWebRequest & Native GZip Compression

When requesting a page with Gzip compression I am getting a lot of the following errors: System.IO.InvalidDataException: The CRC in GZip footer does not match the CRC calculated from the decompressed data I am using native GZipStream to decompress and am looking at addressing this. With that in mind is there a work around for...

Is it possible to tell if a .NET virtual method has been overriden in a derived class?

The very act of asking this question suggests that my approach to this problem is incorrect, so I'm interested in answers which address the question directly, as well as answers which suggest a cleaner approach to what I'm doing. Consider a base class which provides a standard set of services and functionalities, as well as some structu...

Help with .net .ashx files

We have an application that has a coulple of .ashx files used to upload files to the server. The problem we are having is what we we make changes to these files and republish the app, it does not update the .assh files. Really it does nto make the changes in the code behind. Everything else is updated. We are using Visual Studio 2008...

Assign multiple values to a parameter in Crystal Reports

I have added a parameter to my report with the option "Allow Multiple Values" checked. This is a status column (IE, Proposed, In Progress, Completed, Canceled), and I want the user to be able to select which (and how many) different OrderStatus to report on. How I normally set parameters is: report.SetParameterValue("@dtBegin", dtBegi...