.net

Asp.Net MVC: Server Controls vs Html class to render controls?

What are the advantages of rendering a control like this: <% Html.RenderPartial("MyControl") %> or <%=Html.TextBox("txtName", Model.Name) %> over the web Forms style: <uc1:MyControl ID=MyControl runat=server /> I understand that performance can be one reason because no object needs to be created but having the possibility of callin...

WebClient.DownloadDataAsync is freezing my UI

Hi, I have in my Form constructor, after the InitializeComponent the following code: using (WebClient client = new WebClient()) { client.DownloadDataCompleted += new DownloadDataCompletedEventHandler(client_DownloadDataCompleted); client.DownloadDataAsync("http://example.com/version.txt"); } When I start my form, the UI doesn...

Home-grown ORM vs. DataTables?

This is a simplification of the issue (there are lots of ways of doing things), but among applications that need to talk to a database I have usually seen one of two patterns: Object-Relational Mapping (ORM), where (usually) each table in the database has a corresponding "row wrapper" class with public properties that match the columns...

VS Solution, projects vs dlls best practice

Whenever I have a library that use across different websites/ applications I've always just added the library's project into the same solution and reference it from there. This is great when needing to debug within the solution but in all other situations it seems pointless and more space taken up in the solution explorer. Also another...

Sharing JavaScript code between .NET desktop and browser

I have a set of core, complicated JavaScript data structures/classes that I'd like to be able to use both in the browser as JavaScript and run on the desktop with .NET 3.5. Is it possible to compile web-friendly JavaScript into assemblies that my C# code can access? Managed JScript - Is there a compiler for this available that will pr...

Getting Windows XP colours in .NET

I am trying to get a specific colour used by Windows XP in my .NET application. In Windows XP, if you go the Control Panel in 'category view', on the left hand side you have some 'See Also' options (Windows Update, Help and Support, Other Control Panel Options). The colour I'm trying to get is the light blue background colour shown beh...

.net dynamically refresh app.config

How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application start. ConfigurationManager.RefreshSection("appSettings") does not work and I've also tried explicitly opening the config file using OpenExeConfiguration but I always g...

.Net 3.5 WebService can't be called by .Net 1.1 Windows App

I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it. Creating a little windows app in 3.5 as a t...

.NET Forms Authentication: How to limit access to resources like pdf files to authenticated users only

I am using .net2.0 and IIS6. When using .net Forms Authentication: How to limit access to resources like pdf files to authenticated users only; so in order to access a file say mysite.com/mydoc.pdf they would have to be authenticated first (go through the login page) It seems that by default only the .aspx pages are protected. E.g. to...

Application data synchronisation - running the new app in tandem with the legacy

We're in the process of replacing a legacy system. There is going to be a period of time with both the applications running in tandem. Users will be able to use either system and the challenge is to be able to keep their databases in sync with each other. The new system is ASP.NET and the legacy is VB6. Both are running on a SQL Serv...

NullReferenceException when hosting WPF in a System.AddIn

...

WCF javascript proxy not found when endpoint address is not blank

I am trying to setup a WCF service with multiple endpoints with one of the endpoints using the enableWebScript endpoint behavior so that a Javascript proxy will be created on the client (jsdebug/js). When adding the Service Reference to my AJAX ScriptManager, the jsdebug file is not found unless the address of the endpoint is blank. The...

.Net Remoting Return values Discriminating between calls from different threads

I have inherited a middle tier system with some multi-Threading issues. Two different threads, running in the same method of the same instance of a class, are making the same calls to a .Net Remoting server... Does the proxy on the client side know how to route the return values from the remoting server to the correct thread? Are sep...

Get executing assembly name from referenced DLL in C#

What is the best way to get the application name (i.e MyApplication.exe) of the executing assembly from a referenced class library in C#? I need to open the application's app.config to retrieve some appSettings variables for the referenced DLL. ...

WPF TreeView Binding

I've got a class with Parent and Children properties. I want to display this hierarchy in a WPF treeview. Here's my XAML... <TreeView Margin="12" Name="TreeViewPages" ItemsSource="{Binding}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}"> <TextBlock Text="{Binding Path=Sho...

Why is LazyInit<T> restricted to reference types

I have a pseudo-realtime data processing application where I would like to use LazyInit<double> so I don't do calculations I don't need, but LazyInit<T> restricts T to classes. I can work around it, but I'd obviously prefer not to. Does anybody know why this is? ...

How can I create buttons and hook up events from postback

I need to generate buttons initially based on quite a processor and disk intensive search. Each button will represent a selection and trigger a postback. My issue is that the postback does not trigger the command b_Command. I guess because the original buttons have not been re-created. I cannot affort to execute the original search i...

How to determine the last business day in a given month?

How can I calculate the last business day of the month in .NET? ...

UPS Worldship Integration and .net

Are there any UPS WorldShip integration APIS or Libraries out there for .net? I've been tasked with integrating our Sample Order application (A VB.Net/SQL Server app) with UPS, and having it write .xml files for the auto import feature though serialization has gotten my foot in the door- but some of the more advanced shipment options suc...

xsl:template match doesn't find matches

I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am running into difficulties getting the xslt to match Xaml tags. For instance with this Xaml input: <FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentatio...