.net

How can I access my assembly version number in a partial trust environment (no FileIOPermission)

I'm trying to access the Version number of my assembly at runtime. The code I'm using for that requires a FileIOPermission, which I don't want to grant (I'm in the Internet Zone) this.GetType().Assembly.GetName().Version; Is there another way to access the version number which doesn't require elevation? ...

System.Net.Mail AlternateViews losing plain text data

I am trying to send an email with a plain text body and an alternate html body. However, when I snoop the data going over the network the text portion of the email is lost. Here is a sample of my coding attempts. private static MailMessage BuildEmail(string plainText, string htmlBody) { // Add the alternate body to the message. Conte...

What is the purpose of Using?

DUPE: http://stackoverflow.com/questions/75401/uses-of-using-in-c I have seen people use the following and I am wondering what is its purpose? Is it so the object is destroyed after its use by garbage collection? Example: using (Something mySomething = new Something()) { mySomething.someProp = "Hey"; } ...

Cassini/WebServer.WebDev, NUnit and AppDomainUnloadedException

I am using Cassini/WebServer.WebDev to run some automated tests of a WebService using NUnit. I am not doing anything fancy, just public class WebService{ Microsoft.VisualStudio.WebHost.Server _server; public void Start(){ _server = new Microsoft.VisualStudio.WebHost.Server(_port, "/", _physicalPath); } public void Dispose...

Techniques for Calling into a WCF Service from Java...

Besides using Web Services, or POX (or custom HTTP), are there some other techniques that I could utilize for calling services exposed from WCF via _______ to the Java world? These requests will be in the same machine. Maybe RAW TCP/IP? I'm just inquiring for a project that we need to possible provide some method of calling synchronou...

Is thread-local storage persisted between backgroundworker invocations?

Are backgroundworker threads re-used? Specifically, if I set a named data slot (thread-local storage) during the DoWork() method of a backgroundworker, will the value of that data slot persist, potentially to be found be some other thread at a later time? I wouldn't have thought so, but I have this bug... EDIT: This blog post suggests...

JavaScriptResult in asp.net mvc RC1

Why do you need JavaScriptResult as a response? Doesn’t it break the pattern of clean separation of concerns? Can you suggest me some cases where this will be useful? ...

Get unqualified host name in .NET

Is there a .NET equivalent to the winsock function GetNameInfoW() with the NI_NOFQDN flag set? As the MSDN docs for GetNameInfoW explain: Setting the NI_NOFQDN flag results in local hosts having only their Relative Distinguished Name (RDN) returned in the pNodeBuffer parameter. The closest thing I can find is System.Net.Dns.GetHost...

Cannot step into .NET framework source with VS2008 SP1.

Somehow my VS2008 SP1 has lost the ability to step into .NET framework sources. I've played around with checkboxes to no end; I've re-deleted the Symbol cache folder a dozen times; and I've tried all kinds of debug symbol servers. All it does is download some .PDB files, but when I try to select a stack frame in .NET, I always get the m...

How can I delete a security group from Active directory in .NET?

How can I delete a security group from Active directory in .NET? ...

WCF Error: This collection already contains an address with scheme http

I built a web application containing a wcf service contract and a silverlight control which makes calls to that wcf service. On my development and test servers it works great. When I deploy to our live server and run the application I get an exception of type System.ServiceModel.ServiceActivationException which states that the service ...

Sharing data types from multiple Web References.

Say a vendor has provided two separate webservices, which both share the same data types and same namespace. e.g. The following webservices both contain similar objects, such as a TestCredentials object: TestWebservice/Testwebservice1.asmx TestWebservice/Testwebservice2.asmx Including these into Visual Studio using web references I ...

How should I handle strong name issues associated with plugin type systems in .Net

I am working on an SDK. The goal of the SDK is to unify access to various hardware products. As such we have settled on a plugin architecture, using an abstract factory pattern for creation. The issue I have is that anytime the SDK changes I have to have the project teams recompile their plugins. Obviously this is necessary if the in...

How can I manage which items are in the ThreadPool?

I have a windows service that runs a method when the services main Timer elapses (OnElapse). The OnElapse method gets a list of .xml files to process. Each xml file is inserted into a ThreadPool. I want to make sure I don't insert 2 XML's with the same name into the ThreadPool. How can I manage which items are in the ThreadPool? I ba...

Stopping Scroll Bar Fade in Vista (.NET or WinAPI)

Hello, Does anyone know of any way to suppress the Vista fade animations on scroll bars? I only want to do this temporarily and I don't think subclassing is an option because the scroll bars are the "automatic" ones generated by the auto-scroll functionality (it's a .NET app but I assume interop is required). The reason I want to do t...

Should I navigate to a relative URI, or navigate to a new instance of a page in WPF?

Is there any difference between calling frame.Navigate and setting frame.Source = new MyPage()? Is one of them more efficient when it comes to memory usage, and is the frame's journal (back, forward buttons) affected differently when using a particular method? ...

Multiple Modes for a Form or Control in a .NET Application?

Are there any opinions on whether or not it is bad design to reuse a Form or Control in a WinForms .NET application by giving it multiple modes? I often find myself wanting to do this. I'll have some UI that needs to be used in multiple places and instead of reusing the code, I'll give the form a mode that determines things like what tex...

Multi column primary key mapped to a Dictionary<>... aka Struct vs. Class

So I've been trying to figure out the most efficient way to pull off this trick: I have a two column primary key in the database (an int and a string) and I'm trying to make a cache (I like using dictionaries) and I need to have a way to reference the two values as a key to get the object out. The key is private struct PageNameOnSite ...

Authentication accesing ActiveDirectory with DirectorySearcher

I need to access information in my Active Directory domain using domain credentials. The DirectorySearcher class does not have user and password arguments. How can I specify them? ...

Crystal Reports

I upgraded my ASP.Net app from .net 1.1 to .net 2.0. All of the webpages work fine but the crystal reports won't load. Stack trace: Load report failed. StackTrace: at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename...