.net

ViewResult or ActionResult | does it makes sense to use ViewResult if ActionResult is good for everything anyways ?

In asp.net mvc there is ViewResult for returning a View and ActionResult for returning whatever you want, so is there some good reason why should I use ViewResult instead of ActionResult when I'm sure that I will return a View ? ...

Setting AcceptButton to None still closes the form on ENTER.

I have a MDI windows forms application and my child forms mostly have "OK" and "Cancel" buttons. However I do not want them to be activated with ENTER/ESC keys to prevent accidental saves/aborts. So, the form has both AcceptButton and CancelButton set to none. The ESC button indeed does nothing, but the ENTER button still closes the form...

How to reserve public API to internal usage in .NET?

Dear ladies and sirs. Let me first present the case, which will explain my question. This is going to be a bit long, so I apologize in advance :-). I have objects and collections, which should support the Merge API (it is my custom API, the signature of which is immaterial for this question). This API must be internal, meaning only my ...

How to store an ItemsSource for an ItemsControl (ListBox, ComboBox) in the app.config?

After much research and trial and error I found how to store the items for a ListBox and ComboBox in the app.Config. I am heavily indebted to Jon Rista, who wrote a series of articles about the Net 2.0 Configuration classes. I constructed a (large!) code snippet that will generate all the code you need by just inserting three strings! En...

Is there an API for accessing data from Live Calendar?

The question actually in it. Google Calendar provides a convenient API for access to their data, and whether the same API for Live Calendar? ...

How do I split a string by strings and include the delimiters using .NET?

There are many similar questions, but apparently no perfect match, that's why I'm asking. I'd like to split a random string (e.g. 123xx456yy789) by a list of string delimiters (e.g. xx, yy) and include the delimiters in the result (here: 123, xx, 456, yy, 789). Good performance is a nice bonus. Regex should be avoided, if possible. Up...

Chat Service / Server for ASP.NET

I'm looking to have a livechat service integrated within a site where I can create chat rooms on the fly based on participants tied to that specific area... Anyone recommend using a 3rd party service I can install on the server that integrated easily with .NET, or just build one using polling method? I'd like something with socket conn...

Weird behaviour of the app.config deployment after updating it.

I moved some hardcoded settings to a custom Section (so I did not use the <appSetting> tag) in the app.config of my ClickOnce application. When updating, the clients got an error stating that the server gave a 404 not found error for the file "myapp.exe.config.deploy". Browsing on the server I did find the changed app.config there, only...

.Net Application Cache in Cloud Environment

I'm using the Enterprise Application Block and my application is hosted in a Cloud Environment. I was wondering what else I need to do with my implementation to make it as efficient as possible. ...

Is generic Money<TAmount> a good implementation idea?

I have a Money Type that allows math operations and is sensitive to exchange rates so it will reduce one currency to another if rate is available to calculate in a given currency, rounds by various methods. It has other features that are sensitive to money, but I need to ask if the basic data type used should be made generic in nature. ...

Please help debug this ASP.Net [VB] code. Trying to write to text file from SQL Server DB.

I am a PHP programmer. I have no .Net coding experience (last seen it 4 years ago). Not interested in code-behind model since this is a quick temporary hack. What I am trying to do is generate an output.txt file whenever the user submits new data. So an output.txt file if exists should be replaced with the new one. I want to write dat...

How do you set a variable value from another form?

Hi, c# .Net 3.5 visual studio 2008, windows xp I have a main form in a project, given a specific set of circumstances another form is instantiated and displayed to the user: Form frmT = new frmTargetFolder(expName, this); frmT.Show(); As you can see, I am passing a reference to the new form from the current one. My question...

Handling FormatExceptions using XmlSerializer.Deserialize

I have a third party web service that returns this xml <book> <release_date>0000-00-00</release_date> </book> I am trying to deserialize it into this class public class Book { [XmlElement("release_date")] public DateTime ReleaseDate { get; set; } } But because 0000-00-00 isn't a valid DateTime, I get a FormatException. Wh...

How do I avoid an infinite loop when overriding a virtual property?

Is it possible to ignore set and get when I'm assigning to or retrieving a value? In specific, I'm inheriting from a class that has a property declared like this: virtual public Int32 Value { get; set; } What I'd like to do is to override it and do something useful in those set and get's. The problem appears when I override it, I als...

Using Office 2010 web apps with ASP.NET

Would it be possible to use the Office 2010 web apps with an ASP.NET application? For example: - For each user of my ASP.NET application there is a folder with Word documents on my server - The ASP.NET application displays the available documents in a grid to the user - When clicking on one of the documents in the grid, the Word documen...

How can I run NHibenate queries asynchronously?

Hello, One way to increase scalability of the server application is to run IO-bound operation (reading files, sockets, web requests, database requests etc) asynchronously. This does not mean run then in the ThreadPool which will just block threads while operation is being executed. The correct way is to use asynchronous API (BeginRead, ...

Explicit behavior with checks vs. implicit behavior

I'm not sure how to construct the question but I'm interested to know what do you guys think of the following situations and which one would you prefer. We're working at a client-server application with winforms. And we have a control that has some fields automatically calculated upon filling another field. So we're having a field curre...

i got an error in login code

I tried writing a login code in vc#.. I got the following error.. The type or namespace name 'LoginControl' does not exist in the namespace 'ErikSchmidt' (are you missing an assembly reference?) Please help me rectify this error. ...

How to handle missing files on MVC

What is your preferred way to handle hits to files that does not exist on your MVC app. I have couple of web apps runing with MVC and they are constantly getting hits for files folders etc. that does not exist in the app structure. Apps are throwing exception: The controller for path could not be found or it does not implement IControl...

Go To Statement Considered Harmful?

If the statement above is correct, then why when I use reflector on .Net BCL I see it is used a lot? EDIT: let me rephrase: are all the GO-TO's I see in reflector written by humans or compilers? ...