.net

What are the best recources for learning .NET webservices?

I'd like to get up to speed on web services-- I've found that I really like the video format; I tend to skim when I'm reading (bad habit) and I generally don't get the full value out of the video. I would like to see any kind of good resource that you can recommend though; the best thing to do is to collect the best resources. ...

WinForm UI Validation

I need to implement input validation throughout my winform app. THere are many different forms where data can be entered and I would like to not have to go control by control by form and create isValid etc per item. How have others dealt with this? I see that most related posts deal with Web Apps and/or mention Enterprise Library Va...

XLS to PDF conversion inside .net

I've been looking extensively for a tool that takes an existing XLS file and converts it to PDF that then gets saved out to disk. The catch is I need to be able to call it from within my .net console application, which eliminates most tools I've looked at. Has anyone used something like this that they would recommend? My client is will...

WebBrowser.Refresh problem in VB.Net

I'm working on a webcrawler in VB.net, and using the System.Forms.WebBrowser object for handling navigation on sites that use javascript or form posts, but I'm having a problem. When I navigate backwards (WebBrowser.GoBack()) to a page that was loaded with a form post, the page has expired and I have to do a refresh to resend the reques...

Why is it a bad idea to use Session to store state in high traffic websites?

I am watching the ASP.NET learn videos on asp.net/learn. In this tutorial, they are building a quiz engine. At one point, the narrator explains that we are going to use the Session object to maintain the state between each page (each page contains a question and four answers). He says that "since this is a low traffic website" it is o...

refactoring LINQ IQueryable expression to remove duplicated portions of queries

I have some linq queries that have redundancy I'd like to factor out a single piece of code. These are join experssions that are IQueryable, and its important I don't cause the query to be evaluated earlier than it would be without the refactoring. Here is a simplified query: var result = from T in db.Transactions join O in db.Orders...

Do I need to override GetHashCode() on reference types?

I read most questions on StackOverflow with regards to GetHashCode. But I am still not sure whether I have to override GetHashCode on reference types. I picked up the following from someones answer in another question: Object.GetHashCode() uses an internal field in the System.Object class to generate the hash value. Each object ...

Getting a reference to the ViewModel from an IValueConverter

Is there a clean and/or an accepted standard way of referring back to the ViewModel from an IValueConverter, or does that break the MVVM pattern? Basically, I want to convert bound data in the UI based on other properties of the ViewModel. I guess this is the same question as how do you refer back to the Window/Page from an IValueConve...

Is there a way to enforce an atomic operation with no context switch in c#?

I have several lines of a method that I would like to ensure that there is no context switch to another thread while executing these? Yes, re-architecting is an option but it would be far more expedient for now if I could do this. Is this possible? If not then does anyone know the reasoning behind the decision? Edit: The reason I am ...

Hook LoadLibrary call from managed code

We would like to hook calls to LoadLibrary in order to download assemblies that are not found. We have a handler for ResolveAssembly that handles the managed assemblies, but we also need to handle unmanaged assemblies. We have attempted to hook LoadLibrary calls by re-writing the imports table via techniques specified in "Programming ...

String.Format Doesn't Format a String

It seems as though String.Format won't format a string as an input. Am I doing something wrong, or is this just native behavior? Input : 0.37 This doesn't work. string x = String.Format("{0:P}", myString) Output : 0.37 This does. string x = String.Format("{0:P}", Convert.ToDecimal(myString)) Output : 37.00 % ...

How to make vb.net property visible only within specific namespace?

I got some set of base classes within one namespace and few sets of derived classes in other namespaces. Everything in one project. Something like: Namespace Base Public Class BaseElement Protected Friend Readonly Property SubElements() as BaseElements End Class End Namespace ... Namespace Books Public Class Book Inherits Base.B...

Access non-public members - ReflectionAttribute

Hi I am loading assembly B from assembly A. I am trying to enumerate private members of the type located in assembly B. How do I use ReflectionPermission to accomplish this task? I couldn't find anything useful on the MSDN. Assembly asm = Assembly.LoadFrom("Chapter13.exe", AppDomain.CurrentDomain.Evidence); //AppDomain.CurrentDomain....

MSBuild and BuildUri

I am trying to add a BuildStep to the AfterBuild target in MSBuild and I am using the following <Target Name="AfterCompile"> <ItemGroup> <TestAssemblies Include="$(OutDir)\DataStoreUnitTests.dll" /> </ItemGroup> <BuildStep Name="Run unit Tests" TeamFoundationServerUrl="$(TeamFoundationServerUrl)" ...

WCF Web Service, cross-domain example.

Can anyone point me to a good/simple example of creating a WCF web-service sitting on one website, followed with a simple example consuming that WCF web-service on another website? ...

View assembly hash

Hi I have signed my assembly with strong key. I am able to locate public key in assembly manifest using ildasm. I am not able however to locate assembly hash which should be placed in assembly along with the public key. Where can I find computed hash? Kind regards PK ...

How to configure log4net programmatically from scratch (no config)

This is a Bad Idea, I know, but... I want to configure log4net programmatically from scratch with no config file. I'm working on a simple logging application for me and my team to use for a bunch of relatively small departmental applications we're responsible for. I want them to all log to the same database. The logging application is ju...

Rhino Mocks: How to clear previous expectations on an object?

I would like to set up a return value _stubRepository.Stub(Contains(null)).IgnoreArguments().Return(true); but then in a specific test, override that expectation to return false. Something like _stubRepository.ClearExpectations(); //<- this does not exist, I'm just making something up _stubRepository.Stub(Contains(null)).IgnoreAr...

Get dependencies from SQL query

I'm trying to do some SQL query validation programatically in C# (without invoking the actual database). Essentially, I'd like a user to be able to enter a view, UDF, or SP and have its dependencies validated immediately. The user would be entering these into a custom tool for defining database objects. Thus, if a user entered: CREAT...

What tools are available to generate key-pair, enroll with SCEP, use for TLS server on .Net?

The specification I am working with requires that a key-pair be generated and a certificate be automatically enrolled via SCEP to a specified server and used as both a TLS server and client certificate with OCSP validation of the counterparty. Are there any tools available for .Net to do this sort of thing? Pure-managed code and Compac...