.net

IIS 6 Compress static files when using Wildcard application mapping

I'm using IIS 6 with EPiserver CMS which requires all requests to go through aspnet_isapi.dll. I want to gzip all my static files (js, css mainly). Trying to setup compression in IIS didn't work. Is there a setting in EPiServer that will allow me to achieve this? Can .net framework compress files automatically? ...

Best Practices for uploading files to database

I am looking for any best practices or ideas on how you would create an interface with a DB from a .NET web application to upload data from Excel files Should I use a mechanism that allows all the records to be loaded and flags the errors or should I use a mechanism that stops the load when an error occurs. I've never had to deal with t...

Submit changes of only one entity

If I select many rows from one table with one instance of DataContext. And then do I some changes in properties in the rows, can I submit changes to database only for one of the selected rows? ...

Is StringBuilder.Replace() more efficient than String.Replace?

If you have to use String.Replace() to replace test 50 times, you essentially have to create a new string 50 times. Does StringBuilder.Replace() do this more efficiently? E.g., should I use a StringBuilder if I'm going to be replacing a lot of text, even while I won't be appending any data to it? I'm using .NET, but I assume this woul...

Is there a way to programatically "reboot" a .net assembly?

Hypothetical situation: let's say I have a 3rd party .net assembly being used in the ASP.Net web system that I'm working on that just kinda crashes every now and then. When it does so, all calls to it throw exceptions until the system is rebooted. This is, obviously, a little sub-optimal. Is there a way to reboot just that assembly fr...

Is there a Subversion API that can be used to program against in .NET

Is there an API to access Subversion from C#? ...

Suggestions for Localising Exceptions

I need to add localization to the exceptions thrown by my application as a lot are ApplicationExceptions and handled and logged to an error report. Ideally I want to create a new Exception, imheriting from ApplicationException that I can pass the resource key as well as arguments to, so that the exception messsage can be built up from t...

Where can I find Visual Studio style tabs in either a built-in or 3rd party component?

I want to get Visual Studio style tabs (you know, the ones where you can tab through the currently opened files). Is there a 3rd party component that does this? How hard would it be to do myself? ...

How to do hierarchical configuration in .NET's app.config

app.config configuration sections are nice, but I often need multiple configuration sets, but with small difference. what I want is: Have one section with default configuration (this one is created with the designer, and thus has the auto-generated strongly-typed accessors in the Settings class Another section with only the "new" item...

Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3?

Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3? --edit after answer accepted -- This is what the code would look like. HtmlElement myElement = getElementByID(id); IHTMLElement3 h3 = (IHTMLElement3) myElement.DomElement; Thanks @korchev ...

Code documentation: How much is too much?

How much code documentation in your .NET source is too much? Some background: I inherited a large codebase that I've talked about in some of the other questions I've posted here on SO. One of the "features" of this codebase is a God Class, a single static class with >3000 lines of code encompassing several dozen static methods. It's eve...

Configurable Columns in ASP.NET

Does anyone have a suggestions as to the best way to allow users to select which columns appear in a datagrid? I would like them to be able to set this up. It would be stored with the user in a profile and loaded each time the user loads the grid. I was thinking about something with ASP.NET personalization. ...

How do I get the HTML output of a UserControl in .NET (C#)?

If I create a UserControl and add some objects to it, how can I grab the HTML it would render? ex. UserControl myControl = new UserControl(); myControl.Controls.Add(new TextBox()); // ...something happens return strHTMLofControl; I'd like to just convert a newly built UserControl to a string of HTML. Answered (below): Using azams...

How do I determine if a given date is Nth weekday of the month?

Sorry if the title is awkward, but I can't think of a better summary. Here is what I am trying to do: Given a date, a day of a week and an integer n, is the date the nth day of the month? For example: input of 1/1/2009,Monday,2 would be false because 1/1/2009 is not the second Monday input of 11/13/2008,Thursday,2 would return true ...

Unpacking _WTS_CLIENT_ADDRESS.Address in vb.net (retreiving IP address from Terminal Services Client)

I have the following structure: <StructLayout(LayoutKind.Sequential)> _ Public Structure _WTS_CLIENT_ADDRESS Public AddressFamily As Integer <MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> _ Public Address() As Byte End Structure Which is populated by the following call: Dim _ClientIPA...

How to increase the max upload file size in ASP.NET?

I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default. I have found in certain places referencing the below code at msdn. [ConfigurationPropertyAttribute("maxRequestLength", DefaultValue = )] None of the references actually describe how to use it, and I have tried sever...

.NET Communications Component

Hi, I'm looking for a component for C#.NET 2008 Professional that is capable of doing the majority of the network communications work that is required of our application so our programmers don't have to. This component should function similarly to the way RealThinClient (RTC) does. The component must be able to gracefully lose and reg...

Does C# optimize the concatenation of string literals?

For instance, would the compiler know to translate string s = "test " + "this " + "function"; to string s = "test this function"; and thus avoid the performance hit with the string concatenation? ...

How to use terminal services programmatically

I want to access remote server using my program (C# .NET) and execute there a program in the context of connected user, just like using Remote Desktop. I don't want just run a program using some user account(like RunAs), but to have a separate execution session like Remote Desktop I guess terminal services should be used somehow, but I...

How to return JSON from a 2.0 asmx web service

I saw another question like this but it did not answer my question. I am using .Net framework 2.0 / jQuery to make an Ajax call to a 2.0 web service. No matter what I set the contentType to in the ajax call, the service always returns XML. I want it to return Json! Here is the call: $(document).ready(function() { $.ajax(...