.net-2.0

C# Enumerations and Duplicate Values - dangers?

I was wondering about C# Enumerations and what happens with duplicate values. I created the following small program to test things out: namespace ConsoleTest { enum TestEnum { FirstElement = -1, SecondElement, ThirdElement, Duplicate = FirstElement } /// <summary> /// Summary descri...

Reading dll.config (not app.config!) from a plugin module.

I am writing a C# .NET 2.0 .dll that is a plug in to a Larger application. The visual studio project for my module has a app.config file which is copied to a MyProj.dll.config along side of MyProj.dll. The plan is that MyProj.dll.config will be edited after the .dll is deployed. I am trying to read my settings from that modified loc...

Improving Catalog Management C#

There is a catalog management page where user enters color in comma seperated format in the form,and submits the entry with some basic product description and price detaisl etc. A new panel appears,which has a drop down that is populated with the colors entered in the above part of the screen,Now user can upload the images one by one for...

I want to add a control to gridview if column is Null Is it possible in asp.net 2.0

Hi I have a gridview with data. Before filling the gridview i want to validate if column is Not null. If null i want to add control to gridview. Is it possible Thanks in advance ...

How to get short "domain name" from dns domain name?

Forgive me if my understanding of this topic has some shortcomings, I only know what I know about domains and active directory because of what I've picked up from working with them. There are two different "versions" of a domain name. The first is what I call the DNS domain name which would be like company.int (for the user max@company....

appSettings not being read from machine.config in Vista

I've recently moved up to Vista x64, and suddenly, my machine.config appSettings block isn't being read by any .NET assemblies. Right after configSections, and before configProtectedData in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config, I have: <appSettings> <add key="foo" value="blah"/> </appSettings> <system...

Stopping a webtest if an extraction rule failed

I need to stop a web test from running if an extraction rule fails. The Extract method of the extraction rule class looks like this: public override void Extract(object sender, ExtractionEventArgs e) { try { // fancy logic going on here } catch (ExtractionException ex) { e.Message = ex.Message; ...

How do I retrieve a list of logon/logoff/lock/unlock times in Windows?

Is there any way to get a list of times that a user logged on, logged off, locked, or unlocked their computer for the past week or so without adding a service to track it as it happens? Does Windows even keep that information for that long? ...

Why can TimeSpan and Guid Structs be compared to null?

I've noticed that some .NET structs can be compared to null. For example: TimeSpan y = new TimeSpan(); if (y == null) return; will compile just fine (the same with the Guid struct). Now I know that stucts are value type and that the code above should not compile, unless there's an overload of operator == which ta...

What should I use for graphs in an ASP.NET 2.0 web application?

I need to implement fairly simple bar charts with "trend lines" (not sure what they're actually called) in an ASP.NET 2.0 web application. What is a good free or nearly free solution for this? I also need to be able to generate PDFs (if nothing else than by printing them to a PDF print driver) server side, so it can't be a JavaScript cli...

Reference assembly located on Network Share in ASP.Net

Where I'm at we have a large number of programs that can run that all use features from a set of assemblies located on a network share: things like writing to a common systems log, DB connection strings, some common business objects and functions, etc. We like this setup, because it makes it easy to deploy bug fixes and new features: ju...

In vb2005.net is there a function that works like the php function "htmlentities"

In VB 2005 .Net is there a function that works like the php function "htmlentities"? ...

Combine Multiple Predicates

Hello, Is there any way in c# .NET 2.0! to combine multiple Predicates? Let's say I have the following code. List<string> names = new List<string>(); names.Add("Jacob"); names.Add("Emma"); names.Add("Michael"); names.Add("Isabella"); names.Add("Ethan"); names.Add("Emily"); List<string> filteredNames = names.FindAll(StartsWithE); sta...

ASP.NET 2.0 Website uses .NET framework 3.0 DLL

We are developing ASP.NET site in VS.NET 2005. This site is will be hosted on server which has .NET 3.0 installed and in IIS, ASP.NET 2.0 would be selected under ASP.NET tab. We would use external DLL which is being developed in VS.NET 2008 with .NET 3.0 as taraget framework. Here they are using .NET 3.0 / C# 3.0 features such as Lamda ...

How do I make an ASP.Net 2.0 web control that can accept HTML as a string (for a property) between the start and end tag?

Basically I want to be able to have a custom control: public class MyControl : WebControl { private string html; public string Html { get { return html; } set { html = value; } } } And then in an ASPX page use it like this: <tag:MyControl runat="server"> <div> <span>Some Text</span>...

Stalling Regex in VB.Net 2.0 (for ASP.Net)

I'm running a simpler version of this regex: <p\s*>(?:&(?:nbsp|\#0*160|x0*A0);|(?:<br\s*/?>)|[\s\u00A0]+)*</p> On this string: <p>paste in some bullets from word...</p><p>Firefox:</p><p>Bulleted list test:</p><ul><li>One </li><li>Two <ul><li>Sub item one </li><li>Sub 2 <ul><li>Subsub item1 </li><li>Subsub2</li></ul></li><li>Sub3</li>...

Compare two datasets in C#

i have two datasets and i need to compare these two datasets such that if ID does not exist in one table then i need to write insert Query else update query. For Ex: Id in One dataset ID in second Dataset 1 1 2 2 3 4 I need to insert ID 3 to sec...

MSMQ in .net as a Service

Hello, We have a Java WebService which is sending messages(XML file with a set of records) using MSMQ. I need to build a small application in .net using VB.net which should pick those messages and read them and insert into SQL database. Do you guys have any suggestions? How can we read MSMQ messages on real time. Any resources or link...

Replace tokens in an aspx page on load

I have an aspx page that contains regular html, some uicomponents, and multiple tokens of the form {tokenname} . When the page loads, I want to parse the page content and replace these tokens with the correct content. The idea is that there will be multiple template pages using the same codebehind. I've no trouble parsing the string da...

Example of messages to send to a telnet server

We have a unix box in our ofc. We usually telnet to this box and initiate commands on it. We usually do this from windows clients from the command prompt using the telnet.exe. We simply provide the ip of the unix box and it loads up a screen where we provide the login credentials. There is a default message before the login prompt saying...