.net

Threadsafe way to add and remove items from list in .Net

I want to add items to a list from one thread and from another thread remove items from the same list. However, I am not sure if I will run into problems with multiple threads accessing the same object. I have read a bit on the lock statement but I am not sure how to implement this. In short, the question is, how do I ensure thread safe...

set session timeout in web.config

Hello everyone, I have tried very hard but cannot find a sample about how to set session timeout value for in-process session for an ASP.Net web application. I am using VSTS 2008 + .Net 3.5 + C#. Here is what I wrote by myself to set timeout to be 1 minute, is it correct? I write under system.web section in web.config, <sessionState ...

What .NET Framework and C# version should I target with my class library?

I'm building a DLL class library - I want to make it usable by as many people as possible. Which version of the .NET Framework and which C# version should I use? Is it possible to produce a backwards-compatible DLL or different DLLs for different versions? Or does Windows automatically update the .NET framework so I should just use th...

VS 2008 The operation could not be completed. Not enough storage is available to complete this operation.

On updating my working copy from SVN. I get this error. The operation could not be completed. Not enough storage is available to complete this operation. This error also corrupts my all reference in main project ( not in DAL not in BLL). and I have to add all (.net or 3rd party dlls) again. It was working OK but I am getting this e...

Download all PDF Attachments from Gmail Account in C#

Can someone point me to a code sample that downloads all attachments of a specific type (eg. PDF) from a gmail account. I have been looking at a few gmail API's but haven't found what I am looking for. ...

.NET Code refactorings, what is your best practice?

What are your .NET code-refactoring best practices? ...

Using TypeMock Isolator.Swap.AllInstances<T> in a Visual Studio Load Test?

I have the following tests setup. [TestClass, Isolated] public class TestClass { public TestClass() { } private TestContext testContextInstance; public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } [ClassInitialize, Isolated] ...

Why is AllowDBNull true for Sql non-nullable columns?

When I read a record from SQL Server, a non-nullable column comes through as a DataColumn with AllowDBNull set to true. What is happening here? ...

asp.net --> forgot password functionality ..

Hi, I am doing "forgotpassword functionality" in asp.net My forgotpassword.aspx page consists of a username, security question, security answer, new password,retype password and a submit button. When I click on the "forgotpassword" link at the previous page, it should prompt me about the security question and when I enter the answer a...

What resources are people using for TDD in ASP.NET MVC using Rhino Mocks?

Does any know or use and good resources for TTD with ASP.NET MVC specifically with Rhino Mocks. Do you prefer any other Mocking Framework? My choice on Rhino Mocks is simply because it seems the one which is most up to date and from what I have read is extremely capable! ...

Natural language statistics query to SQL query converter

We would like to include a facility in an ASP.NET web application that will allow a user to type in a natural language (or reasonably close to natural) question about a SQL data set (SQL Server) and get useful information in return. The sort of results required is to include min, max, std deviation, top 10, total for a column, and anythi...

Dynamically Loading Page Class/Assembly: Type or name could not be found in the global namespace

Hi, I am trying to create an ASP.Net Web application that stores it's "content" (ASPX/ASCX and assemblies) somewhere other than the file system (Inside a service, for example) and loads them in dynamically as required. I have successfully created a VirtualPathProvider that takes care of reading ASPX/Master/ASCX files from alternate loc...

Minimise database updates from changes in DataTable/SqlDataAdapter

My goal is to maximise performance. The basics of the scenario are: I read some data from SQL Server 2005 into a DataTable (1000 records x 10 columns) I do some processing in .NET of the data, all records have at least 1 field changed in the DataTable, but potentially all 10 fields could be changed I also add some new records in to the...

RichTextBox SelectionChanged called before MouseDown?

I'm working with a RichTextBox, and would like to do one thing in the SelectionChanged event if the mouse is down, and another if it's not (e.g. if the keyboard is used to select something). However, the SelectionChanged event is apparently called before MouseDown, so it seems there's no way for me to know if the mouse is down while pro...

Concatenate fields in a databound ListBox with WPF

Let me start off by saying that I am very new to WPF and LINQ and have been struggling to learn it while working on a project with it at work (don't you hate having to learn things on the fly and complete the project before a deadline!). Anyway, I have a list box of employees that is being bound in the code behind to an ObservableCollec...

How to mock the controller context with moq

I am trying out the MOQ framework and up now I have hit a barrier. The following unit test fails because the actual value of the ViewName property is an empty string. Could anyone point me in the right direction please as to why this is not passing the test? [TestMethod] public void Can_Navigate_To_About_Page() { var request = new...

Expandable WinForms TextBox

I have created a textbox in a Windows Forms application that starts out at a height for entering text in a single line. But I would like the textbox to automatically increase its height if the user enters text that is wrapped within the control. Currently, for this textbox, I have the properties multiline and wordwrap set to true. I'v...

Base64 encoding for images

I am building a service using WCF and I need to send over images. I looked around on how this is done and found that Base64 encoding is often used to send binary data as text. Is this a good practice to send over images (~500 kb)? ...

Optional parameters

I've got a method that takes a bunch of optional parameters and I'm overloading the method to supply the different combinations of signatures. Intellisense pops up with a bunch of different signatures but I think it looks quite confusing now because there are different combinations I need to provide, not just building up parameters on th...

to show loading while navigating a web page using c# .net browser

hiii I am developing a window application in which I am showing a web page using c# .net browser. since my web page is quite heavy and its taking time to load . so i want to show loading image while navigating a web page .so tell me how should i do . ...