.net

.net security exception

I am using OpenFileDialog class to browse a file in window application using c#. It is giving the security exception as below. Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. My code is OpenFileD...

.NET - Strategy for multi database support

Our current web application is using SQL Server, we have a requirement for support Oracle now. There are a few options: Data Facade pattern: use Data Facade interface in Business Layer, so SQL Server and Oracle can have their own implementation of Data Access Layer. The problem is it's hard to synchronize DAL code for different type o...

Get currently logged on interactive user for a remote machine?

How do I find out what user, if any, is currently logged on to some remote Windows XP machine interactively? .NET code would be great or any command-line utility that I can call from code. SysInternals psloggedon, as suggested on SuperUser, almost works, but it doesn't tell me which session is interactive. ...

How to turn null to 0.

I built a little program that calculates the average of 15 numbers or less. There are 15 text-boxes, each one's default value is '0'. The program knows to get the sum of all typed numbers and divide it by numbers of text boxes that don't return '0'. But if the user deletes in mistake one of the '0'os in one of the text boxs.. run-time er...

.net security exception

Possible Duplicate: .net security exception I am using OpenFileDialog class to browse a file in window application using c#. It is giving the security exception as below. Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a...

Help refactor legacy custom reporting module

I have intranet win.forms (click once) application with custom built-in reporting module (40+ WinWord & Excel reports). Module is in separated assembly and abstracted via interfaces. We have sources and continue to support it. Common interfaces look like: IReportProvider { // introspection stuff IEnumerable<ReportCategoryInfo> Ge...

use Attr tags for json?

I have this question and i am wondering if a possible solution can be adding attribute tags to say the object[][] maps to MyType[] where element 1 is MyType.IntName and element 2 is MyType.HtmlSz Is it possible in any json solution on .NET? ...

How to get the user a webapplication will run under ?

Question: I have a web setup project. It installs the webapp and puts it into the appropriate virtual directory. So far so good. My question now is: how do I set folder write permission? My problem is, I can set the permissions programmatically, but I need to know the IIS user the application runs under, since it's that user that need t...

C# struct to C++ Marshalling problem

Hi All. I'm invoking a C++ function from within C#. This is the function header in C++ : int src_simple (SRC_DATA *data, int converter_type, int channels) ; And this is the equivilent C# function : [DllImport("libsamplerate-0.dll")] public static extern int src_simple(ref SRC_DATA sd, int converter_type, int channels); This ...

Deriving 2 times on Entity Framework

Hello everybody Let's say we have tables named A, B, C . C derived from B and B derived from A. So if i want to get C table, OfType(C) will bring result as expected. But if i wrote OfType(B) result will include entries of table C. How i could get result just for B ? Is there better solution of Entity Framework ? ...

Character Shuffler

Hey Y'all, I was just wondering if there's a way (using ASP.NET C#) to "shuffle" up the contents of a string, but still be able to click another button and "UNshuffle" it back to its original content withOUT saving the original content? Thank you :) Example: "This is not shuffled." "isuo .tffsnl iTh shed" ...And then I click the "U...

Adding write access for low integrity processes under .Net

I'm creating an FileSecurity for file creation that should have an write access also for low integrity processes. FileSecurity fileAcl = new FileSecurity(); // add everyone IdentityReference sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null); FileSystemAccessRule rule = new FileSystemAccessRule(sid, FileSystemRights.FullCont...

Find an element in xml by its inner text

I am trying to search an xml element from the root element of the file on the basis of inner text. i have tried this but didnt work: rootElRecDocXml.SelectSingleNode("/ArrayOfRecentFiles[name='"+mFilePath+"']"); I know the old school way to traverse all file elemen by element but i dont want to do that. Please note that: my root elem...

[.NET] Get all available cultures from a .resx file group

I need to programatically list the available cultures in a resx file group, but the ResourceManager class doesn't seem to help. I may have : Labels.resx Labels.fr-FR.resx Labels.ro-RO.resx and so on However, how can I find these three (or how many would there be) cultures at runtime? ...

ClickOnce update location - can it <sometimes> be local?

Our ClickOnce deployment has been working great for dozens and dozens of updates - every install looks at the primary publish location, and gets the updates when needed. We now have a new office that has many users and a very small Internet pipe, so they are hoping to download the update once and share it amongst the many users. Does a...

Why does changing this regex class to .+ not provide any match?

If I use this string showPattern = @"return new_lightox\(this\);"">[a-zA-Z0-9(\s),!\?\-:'&%]+</a>"; MatchCollection showMatches = Regex.Matches(pageSource, showPattern); I get some matches but I want to get rid of [a-zA-Z0-9(\s),!\?\-:'&%]+and use any char .+ but if do this I get no match at all. What am I doing wrong? ...

GZipStream: why do we convert to base 64 after compression?

I was just looking at a code sample for compressing a string. I find that using the GZipStream class suffices. But I don't understand why we have to convert it to base 64 string as shown in the example. using System.IO.Compression; using System.Text; using System.IO; public static string Compress(string text) { byte[] buffer = Encoding...

How to create a graph or a radar in Visual Basic .NET?

I'm developing an application with Visual Basic. NET. How do I create a graph or a radar system that uses data from a DataGridView? ...

.NET CF checking RAM physical errors

Is there any common algorithm to check the RAM memory of a device in terms of physical memory access errors? I thought that the simplest way is iteration over the whole memory and writing, reading and comparing each byte. Maybe is there any better way? How to allocate the whole accessible memory in .NET CF? I'm using newly designed Wind...

Does importing more namespaces have an effect on performance?

Does importing a large number of namespaces have an impact on performance? Specifically in C# .NET or in general? Obviously I would not import a namespace I wasn't going to use, and i'd probably never have to import so many as to worry about performance, but this is more out of general interest than an actual, practical problem i'm fa...