.net

C# InvalidOperationException AND Cross-thread operation

In my windows form I have a text box and a button, the text box “tb_LogBox” is multiline text box I am trying to create a background worker that is supposed to call a function i.e. “LogTimer.DnT()” when I compile is and run it Visual studio throws InvalidOperationException. The actual Error I am getting Cross-thread operation not vali...

Spring.Net Books & Resoruces

I'm looking for resources on Spring.Net, has anyone come across any books or sites that you found especially useful? ...

C# MVC: using CSS from another location

I need to keep all images, css, etc in one folder structure and all code in another. I'm trying to get the src paths right and just cannot do it. I have css in the following structure: /public/content/*.css and all project code in this: /protected/Code/... And public and protected are in the same folder. How do I use the public resou...

How to retrieve .NET type of given StoredProcedure's Parameter in SQL?

Hello, I'm creating 'generic' wrapper above SQL procedures, and I can resolve all required parameters' names and sqltypes, but is there any way how to get it's 'underlying' .NET type? My goal is to do something like: SqlParameter param; object value; object correctParam = param.GetNETType().GetMethod("Parse", new Type[] { typeof(...

Crystal Reports Server 2008 - How do you create a APS Logon Token programtically in .Net

Hey all, Could some one guide me to create a APS logon token in .Net programatically? I need to use this token for URL reporting.... ...

Question about XmlSerializer in .NET

I have the following classes in C# that I want to serialize: Item ProjectItem : Item Folder : Item Project (Contains a collection of Item, that may be either a ProjectItem or a Folder) When I serialize a "Project", I get the following... <Project> <Item xsi:type="Folder"> <Name>MyFolder</Name> </Item> </...

Is there a better way to do configSections in VS 2010 Beta2?

I noticed in the default web.config files for the latest release of MVC distributed with VS 2010 Beta 2 that many of the sections are now missing. With a little research I found ScottGu's article explaining why this was. My question is is there a new way to load namespaces in this release of .net and should we no longer be utilizing th...

How to access .net MVC ViewData from Jquery directly

I am passing viewdata into my aspx page like so: //Controller List<user> userList = Data.GetAllUsersForCompany(companyId); List<SelectListItem> dropDownList = FormatUserList(userList); ViewData["UserList"] = userList; ViewData["FormattedUserList"] = dropDownList; return View(); I am populating a drop down with the name of a user, whic...

Thread/process safety for unmanaged resource

We may be accustomed to code below: if(File.Exists(xxx)) { //I am here using(var streamReader = new StreamReader("xxx")) { ... } } Well, the potential problem is that, the file xxx may be deleted by another thread (or process) when the code reaches "//I am here". Thus, the using block will throw exception. Anyway to avoid...

Is it necessary to free the memory in .Net as if in VB6?

I was reading about the Form's events in VB6 such as "Unload" "QueryUnload" and "Terminate", and about the "End" statement: http://articles.techrepublic.com.com/5100-10878%5F11-5533338.html http://visualbasic.freetutes.com/learn-vb6-advanced/lesson6/p5.html I used to have problems with a VB6 app (it calls a lot of windows' apis). When I...

C# Non-Windows Remote Desktop

Hello, I'd like to create a simple remote desktop application (you can view the screen remotely and interact with it). As a first step, I've tried taking screenshots, 1 per second, compressing them to JPEG and sending them over (without interaction), but I've found that even over LAN this is very slow. Do you have any hints on how to d...

What's the most elegant way to bubble-sort in C#?

Can this be cleaned up? using System; class AscendingBubbleSort { public static void Main() { int i = 0,j = 0,t = 0; int []c=new int[20]; for(i=0;i<20;i++) { Console.WriteLine("Enter Value p[{0}]:", i); c[i]=int.Parse(Console.ReadLine()); } // Sortin...

What are the specific security risks of this web services architecture?

I need ammunition to try to promote WS-Security for a set of externally-available web services that interact directly with our production customer service application. My vision is to implement IPassword provider and authenticate with our AD store. The architecture recommendation that came down from on high is SSL, with an IP filter on t...

What are JScript case sensitivity rules?

I am using the ScriptControlClass, for reference and I thought JScript was case sensitive... However, my user base has surprised me... I have several methods I have provided the users in all upper such as: IF, EMPTY, AGE, PARSE, etc... Well, today a user filed a defect that issampgroup was not working. I investigated and informed the...

DateTimePicker and UserPaint...Text and button missing

Hello there. I've got a DateTimePicker which I 'dynamically' assign the Paint-Event, unfortunately as long as this Event is assigned neither the text nor the DropDown-Button are rendered (but are working). I've written a component which takes another control and draws something on it Public Sub New(Byval parent As Control) Me._par...

A difference in style: IDictionary vs Dictionary

I have a friend who's just getting into .NET development after developing in Java for ages and, after looking at some of his code I notice that he's doing the following quite often: IDictionary<string, MyClass> dictionary = new Dictionary<string, MyClass>(); He's declaring dictionary as the Interface rather than the Class. Typically I...

Windowing System for .NET Console

Hi, Does anyone know of any simple .NET windowing systems for the console? I'm looking for something that manages areas of the console such that they are automatically scrolled independently of other areas. For example, I could create a status strip down the bottom and a main content area above it. It would also be useful if it handled...

Using "FOR XML" with XML Serialization with DATETIME type

I'm having issues trying to add some dates to a pre-existing class that is loaded via XML Serialisation, and it's not doing what I thought it should do. I knocked up a basic test with SQL of (where EffectiveFrom and EffectiveTo are declared as DATETIME) SELECT o.EffectiveFrom AS [@EffectiveFrom], o.EffectiveTo AS [@EffectiveTo], FROM...

Http request timeout issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 to develop a console application and I send request to another server (IIS 7.0 on Windows Server 2008). Here is my code. My question is, as in my code, I use a while loop to read chunks by chunk from server. The timeout request.Timeout = Timeout * 1000 is responsible for (1) timeout f...

DOC to PDF library (not necessarily free)

Hey all, Just after a bit of advice on peoples preference with DOC to PDF libraries for .NET. At the moment we currently piggy back on OpenOffice but this isn't really ideal. What i'm after is a library that will allow me to convert a .DOC and write out a .PDF in code. The library doesn't have to be free and it must also work with ASP....