MVC - System.Threading.ThreadAbortException in a parallel task

In my MVC application, a superadministrator can set a queue of tasks such as updating database. So, when an admin adds an update to the queue, the controller starts a new tasks that works in a background. However, when you add a few tasks, the applic

How to access a non-static property of another class

I have a non-static property inside a non-static MainForm class: public string SelectedProfile { get { return (string)cbxProfiles.SelectedItem; } set { cbxProfiles.SelectedItem = value; } } I would like to get the value of this property, from another

Why HttpClient does not open any page in the browser?

I have a console application and I want to open a page from it. I tried this: HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:9000/"); client.GetAsync("http://localhost:9000/"); but when I r

for each loop in an iterator method

Check out this program: static class Program { static void Main() { GetLinks(); Console.WriteLine("Program failed!"); } static IEnumerable<string> GetLinks() { throw new Exception(); foreach (var item in new string[] { }) yield return item

Link with a localized value using enum in C #

Binding Drop down with localized value using enum in C#. I have value for all the languages. So I do not need to fetch it from anywhere else. I can write all the value in different languages resx file. But I am not sure how it works. I am using C# wi

Updating the database for a specific user

I'm trying to updata my sql database for a specific name, and the following code is not working. Any ideas why? Here is what I am doing on the button click: string person = listBox2.SelectedItem.ToString(); string memberStatus = "platinum"; stri

How to use a type as an expression?

I was wondering if exist a trick to use a Type as an expression, for example in this code: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim ControlType = CheckBox ' CheckBox is a type and cannot be used as an expressio

Image scraper with C #

I'm trying to go through a web pages source code, add the <img src="" to an HtmlElementCollection. Then I'm attempting to cycle through each element in the element collection with a foreach loop and download the im

Strange error for use? Operator

Possible Duplicate: The type of the conditional expression can not be determined? I currently wrote this statement: byte? Col_8 = (Rad_8.SelectedValue == null) ? null : byte.Parse(Rad_8.SelectedValue); but it has this Error: Type of conditional expre

The ILGenerator method online

Given following code: using System; using System.Reflection.Emit; using System.Diagnostics; using System.Reflection; namespace ConsoleApplication1 { class A { public int Do(int n) { return n; } } public delegate int DoDelegate(); class Program { publ

Remove items from a list of other lists with criteria

i have a list of writers. public class Writers{ long WriterID { get;set; } } Also I have two lists of type Article. public class Article{ long ArticleID { get; set; } long WriterID { get; set; } //and others } so the code i have is: List<Article> Ar

Is it possible to get the height and width of the scrollbar?

I'm trying to get the height and width of the scrollbars that are displayed on a ListView. Is there an easy way to do this? I did some google'ing and it looks like it might be a system setting. I'm just not sure where to look.Yes, it is a system sett

How to get the current line in a RichTextBox control?

Say I clicked somewhere inside a RichTextBox control. How can I get the current line the caret is currently on? Btw this is to retrieve the whole text string of that line.That's what RichTextBox.GetLineFromCharIndex() does. Pass the SelectionStart pr

SecurityNegotiationException on Disconnected Domain Client

When I am running a WCF service on my development machine it works as long as the client is connected to the domain. When the machine is disconnected I get the following exception: System.ServiceModel.Security.SecurityNegotiationException: A call to

Microsoft and SAP

For many years I have used the old "SAP DCOM Connector" to communicate between Microsoft based applications and SAP. Unfortunately this old but good and performant technology is no longer supported by SAP since years. Therefore I want and must m

First steps with TDD?

We are in the initial phase of trying to implement TDD. I demo'd the Visual Studio Team System code coverage / TDD tools and the team is excited at the possibilities. Currently we use Devpartner for code coverage, but we want to eliminate it because

.NET XSLT Transformation, is it really streaming?

I have an XML that I need remove empty elements from. I am trying to avoid using the DOM and am trying to do this as streams. I have this code, but I am not entirely sure how correct and optimized this is. StringBuilder xslt = new StringBuilder(); xs

System error 5 Access is denied when starting a .NET service

When I try to start a service I created in Visual Studio I receive the following error: System error 5 has occurred. Access is denied. I am running the command line with elevated privileges, so it's not that problem. Is there any place I can look to