.net

Under ASP.Net MVC v1, is Page_Load called?

Hi, Stupid Monday morning basic/noob question... Is Page_Load generally called for an ASP.Net MVC app? We just have one page, Default.aspx.cs - which only seems to be called for / and not for any sub-paths, so I dont think it is generally called... Thanks for the reply - to clarify, what I want to do in the Page_Load is the security ...

Why FontStretch does not work in WPF?

I am trying setting FontStretch property on a TextBlock in WPF but it seems that it does not work. I tried Expanded, Condensed, etc. but the text appearance does not change. I am working on Windows XP with Framework 4.0 and tested both with Verdana and Arial. Does it work only on Windows 7 or only with some specific fonts? EDIT: If it...

migrating webclient to WCF; WCF client serializes parametername of method

I'm struggling with migrating from webservice/webclient architecture to WCF architecture. The object are very complex, with lots of nested xsd's and different namespaces. Proxy classes are generated by adding a Web Reference to an original wsdl with 30+ webmethods and using xsd.exe for generating the missing SOAPFault objects. My pilot W...

Where will the file without path get created in client system

I have the following code in an Winform Application String[] lines = { "LAST MESSAGE", "101" }; File.WriteAllLines("MPP_Config.txt", lines); On my Development system, the file gets created under Bin\Debug... Where will the file be created in the client once it is installed in the client system ? I deploy to a website using Click ...

NHibernate.Linq : session becomes dirty after select

I have a simple NHiberntate linq query: var queryable = session.Linq<Product>().Where(p => p.Active); Product[] products = queryable.ToArray(); The moment the ToArray() is executed the session becomes dirty (session.IsDirty() returns true). If the transaction is commited there is an UPDATE SQL query generated for each product. Why ar...

Auto-generate WebControls

I want to generate .net code from a template so that it more rapid, so lazy developers (and I mean that in the nicest possible way!) don't have to write them in the IDE, compile them, etc... I know I can roll my own tool which generates the code using reflection (by reading in some text file, etc), but I just wondered if there was an ea...

Is it worth the trouble to avoid using the SqlParameterCollection.AddWithValue method?

Several articles tells you that you should avoid using AddWithValue method because it can lead to poor execution plans and performance. Should I go through my DAL and change all parameters to specify the SqlDbType? Is it worth the loss in maintainability? (If I change a column-type from varchar(50) to varchar(100) I would need to change ...

One office plugin for both Office 2010 and 2007

I've developed an office VSTO3 application for MS Office 2007. Now I'm in a process of porting it for Office 2010. I've created a new project targeted for 2010 and mostly just copy-pasting the code from 2007 project. I've moved as much code as I can to external libraries but still there's quite much code in main project. I was wonderi...

Is it possible to 'talk' to servers in a Windows intranet and pull information? (.Net 4.0)

I am attempting to make a program that will pull data such as OS, IP, Server Name, Websites, Databases, etc. in a server farm. Is there a .Net library that allows you to connect to servers and get information such as this with the proper authentication? I do not really know where to start, thank you. Most of the servers are 2003 stan...

custom events in child userControls c# .net or Child to Parent Communication in UserControls

Okay here is the scenario: I have a parent "SalesUC" UserControl which contains a "itemDetailsUC" UserControl, as well as a status label. (plz see sample below) What I want: If there occurs any exception in itemDetailsUC, it should be able to communicate the exception text to parent control (i.e. SalesUC). Remember: the "ItemDetailsUC"...

How to make HTML Helpers that supports generic type?

public static class EmptyOrNullHelper public static string EmptyOrNull(this HtmlHelper helper, IQueryable(T) type) { //Code } } ...

Setting serial RS232 port settings; any in C# alternatives to SerialPort class ?

In my .NET application I need to achieve serial port setup equivalent to this C++ managed code: ::SetCommMask(m_hCOMM, EV_RXCHAR); ::SetupComm(m_hCOMM, 9*2*128*10, 400); ::PurgeComm(m_hCOMM, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); COMMTIMEOUTS timeOut; timeOut.ReadIntervalTimeout = 3; timeOut.ReadTotalTimeout...

How to write an asmx web service without using app_code directory?

Excuse the title, but it's best I just explain the problem. I have 2 projects in my solution A Class Library A Web Application, which consists of a web service (asmx). the web service has code sitting in the app_code folder, with a file [webservicename].cs Inside the webservice code behind class, I have a web method here is a sam...

How to **delete-protect** a file or folder on Windows Server 2003 and onwards using C#/Vb.Net?

Hi all, Is it possible to delete-protect a file/folder using Registry or using a custom written Windows Service in C#? Using Folder Permissions it is possible, but i am looking for a solution that even restricts the admin from deleting specific folders. The requirement is that the administrator must not be easily track the nature of p...

How to debug .net error where message is masked in Ajax call

Hi, I'm currently working on a page which makes use of the MS Ajax UpdatePanel. However I've run into a strange problem. If I simply compile and view my page, one of the button click events results in an error. However, because the button affects items inside an UpdatePanel the actual exception is hidden from me: all I'm getting is a HT...

Library to resize image in .net

Is there a good library to resize an image in .NET with good quality? I'm not pleased with the quality of resized images that GDI+ produces. It does not matter if the library is free or at a cost. ...

How can i do something like IList<T>.Contains(OtherObjectType) ?

Hi, I have the following classes: Client ClientCacheMedia ( contains Client, Media and some other parameters so it is the link between the media and the client) Media where client contains an IList. Now what i would like to do, is have a way to check if this ilist contains a certain media so : Client.ClientCacheMedia.Contains(MyMed...

What happens at OS level when a .net program exits due to an uncaught exception?

Actual question(s): What happens "in Windows" when a program crashes from an uncaught exception? Is there a dll function, which I can hook, to log some basic information about a crash? Context: I am planning to write a program which will collect some very basic information about any applications which crash on my local pc. I was hopi...

WCF threading - non-responsive UI

Hi everyone. I'm trying to configure some WCF stuff. Currently, I have a server which allows remote users to download files, and client. In the server, I use a ServiceHost class. I assume it should be running on a separate thread, however, the server UI (WinForms) becomes locked when someone downloads a file. Is there a way to manage th...

Refactoring tool

I am using several months ReSharper 4.5 It's very powerfull tool but use a lot of system resources and VS working very slow with it. With which tool I can replace Resharper with the same functionality. Which refactoring tool do you use? ...