.net

how to show the number of characters left in a multiline textbox in asp.net ?

I have a multiline textbox which can contain only 500 characters. Now i want to show the user the number of characters left as they are typing into the textbox as is the case when we use twitter. Kindly help ...

.NET List of Thrown Exceptions

I know that Java enforce the programmer to list all exceptions that will be thrown by the method, and thus creating an easy way of listing all possible thrown exception for the user of code. .NET on the other hand has no such feature, and all we're left with is the API documentation or XML documentation where the exceptions are sometime...

How to save webpage to string with cookies support (httpWebRequest)

I need to read webpage and store its content in string for further processing. Sounds simply but I have problem with cookies support. Opened page says I need browser supporting cookies (or turned on). I've made method trying do that via httpWebRequest - which normally works to me but I've come to a standstill with those unfortunate cook...

.Net Designer assemblies, C++\C# error

I'm working on an designer-heavy application (using Visual C++ 2.0, but a C# solution should still be relevant). My setup is this: I have a UserControl named "Host" I'm attempting a UserControl named "Child" Child contains a property to a class whose type is defined in a different dll entirely, named "mytools.dll" Child works just fi...

GetShortPathNameA not working in C#

I'm trying to get get the short filename from a long filename but I'm having problem in c# code. VB.Net code is: Declare Function GetShortPathName Lib "kernel32" _ Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long Public Function GetShortName(ByVal sLongFi...

Is it possible to localize the appSettings information in web.config file?

I have something like this in mind: <appSettings> <add key="ConfigName" value="configuration" culture="1033" /> <add key="ConfigName" value="konfiguracja" culture="1045" /> </appSettings> but the add element has only 2 attributes - key and value, so I guess it's not supported. Next thing that comes to my mind is: <appSettings> <a...

ildasm and dynamic exe files

Hi There, I am trying to create an application can modify properties in IL to create a slightly different executable. E.g Client A runs app and a label on the WinForm label Reads "Client A:". Client B runs the app and Label Says "Client B". Easy I know using config files or resource files but thats not an option for this project. The Mai...

How do you bypass TLS/SSL cetification validation in WCF for Exchange Web Services

I wan't to bypass SSL and use regular http protocol to connect to a Exchange 2007 server however we dont want to invest in a real SSL cert and the one we use is needed for blackberry enterprise server. Is there a way to bypass this here is the exception Request failed. The underlying connection was closed: Could not establish trust r...

Multiple ClickOnce applications associated with the same file type

I have multiple .Net applications that read the same file type, but when deployed with ClickOnce, the file association in Windows is made to "ClickOnce Application Deployment Support Library", which is what actually launches the program. But once the first .Net application is installed on the workstation, subsequent applications can't b...

Non-Ascii characters not supported by .net?

Hi All, When I added a class with non-Ascii caharacters in the class name, it removed the non-Ascii from class name and when added directly to class it complains of non-Ascii characters. Are Non-ASCII characters not supported in class name and variable name? ...

.net code readability and maintainability

There Currently is a local debate as to which code is more readability We have one programmer who comes from a c background and when that programmer codes it looks like string foo = "bar"; if (foo[foo.Length - 1] == 'r') { } We have another programmer that doesn't like this methodology and would rather use if (foo.EndsWith("r")) {...

Class for mantain a thread safe cache

Hi, I'm developing a thread safe class that I'll use as cache, it should work in .NET and Mono. The items have a time to live, and every time that a object is retrieved, its time to live is refreshed. Each time that I add a item, the timestamp is added to another collection that holds the same keys. A timer raises the method that look...

Putting :base after function?

public LocalizedDisplayNameAttribute(string displayNameKey) : base(displayNameKey) { } if i put :base after the function in the class what does that mean? ...

Is Stopwatch really broken?

At MSDN page for Stopwatch class I discovered link to interesting article which makes following statement about Stopwatch: However there are some serious issues: This can be unreliable on a PC with multiple processors. Due to a bug in the BIOS, Start() and Stop() must be executed on the same processor to get a correct re...

Why do we need a private constructor?

if a class has a private constructor then it cant be instantiated. so, if i dont want my class to be instantiated and still use it, then i can make it static. what is the use of a private constructor ? Also its used in singleton class, except that, is there any othe use ? (Note : The reason i am excuding the singleton case above is ...

service not defined when precompiling a web app with AJAX-enabled WCF Service

I created a web application in which one .aspx page calls an AJAX-enabled WCF service (created with Visual Studio 2008 Add New Item -> AJAX-enabled WCF Service). when I test the application in Visual Studio, it works and the page can call the service from Javascript but when I "publish" (code precompilation using Visual Studio) it to th...

Multiple Input From Keyboard C# WPF

I am writing a Tetris clone in WPF. If I hold down the right arrow key, the current piece shifts right. For playability, I want to allow the user to press another key (i.e. F-key) and rotate the moving piece without having to let go of the right arrow key first. Currently when I do this, the piece stops shifting. My first basic attempt ...

What's the usual term for a local IIS/web application with services?

I've inherited a multi-technology project which comprises a Flash user interface contained in a web-browser-like host and has an ASP.NET piece which provides web services to the Flash UI, background/watchdog services plus a web application for administration of the system. Our transatlantic project conference calls are getting confusing...

How do I fix the "Reentrancy was detected" warning given by the Visual Studio debugger?

When running our unit tests in debug mode, at a certain point the Visual Studio debugger breaks to show the reentrancy MDA. The linked article explains that this occurs when A low-level operating system extensibility point, such as the vectored exception handler calls back into managed application code. Apparently this can cause heap co...

COM Interop - Wait for Excel to Complete Operation

Hello, I am doing some COM Interop work with Excel and other Office Automation Software. A Co-Worker has mentioned to me that I need to wait for these Automation Servers to become ready after issuing a command to them. I, however, cannot see the purpose of this as don't all calls block until the automation server completes the given ...