.net

Entity Framework 4 Error: Unable to update the EntitySet because it has a DefiningQuery

Okay, here's the scenario. I have 3 tables. One called aspnet_Users one called Categories and a linking table called User_Categories. aspnet_Users and Categories both have primary keys (UserId and ID respectively). The linking table has only two columns: CategoryID and UserId, and there are foreign key relationships setup for each co...

How to create advanced search with linqkit

Newbee here: Thinking on using this: http://www.albahari.com/nutshell/linqkit.aspx I am creating an asp .net web app/c#/EF4, where users can perform search from a set of textboxes. Here are the basic rules. User can search on any number of fields. (no fields are required) Each field has an option dropdown to choose "equal" "contains"...

FTPWebRequest: trouble downloading GZipped files

I'm downloading xml files that are compressed using GZip using System.NET.FtpWebRequest. The files I receive are about twice the size as the files on the server and System.IO.Compression.GZipStream does not like them. It returns the following error message: System.IO.InvalidDataException : The magic number in GZip header is not correc...

using Regex with conditions

I have the problem that I can only use one Regex.IsMatch to validate a string and I have to conditions with regular expressions to be matched for the same string, I've looking and seems that I can use regex conditionals like (?(?=regex)then|else) to match both regular expressions on the string value, but I can't reach the same result My...

Why is it necessary to load every argument onto the stack in CIL method?

Hi, in my application I need to dynamically create a type that contains multiple properties. I am aware that in cases such as this, one has to generate an CIL for both getter and setter methods of a property by using an ILGenerator. More by a trial and error than anything else, I've finally arrived to the following code that generates ...

Any way to prevent .NET's WebBrowser's from executing javascript?

I just don't want my WebBrowser to execute javascript at all. I don't need it for what I'm doing and causes errors. Is there any way to preventing from executing it? I tried setting the InnerHtml for all "SCRIPT" elements to an empty string but I get errors. If I can find a way to capture all mouse events and keep the browser from gett...

Is it ok to store a solution inside inetpub?

One of the other developers at my company wrote a .NET 2.0 web site. He stores everything...solution, project, source...everything inside of "inetpub\AppName" (the IIS share). I have never seen this done before. In fact I'm kinda surprised the website loads up in a browser. Are there any disadvantages to doing this over say...storing...

NHibernate: Multiple Entities, One Transaction - Multiple Repositories?

I'm developing a web service using NHibernate, WCF and Oracle 11g R1. The web service is pretty simple: it maps DTOs to POCOs and performs various CRUD operations on them based on the operation called. Each entity has its own set of CRUD methods - this is a temporary, but necessary for the time being. I'm looking for input on a good R...

How can I trap all mouse events on a control?

I need to capture all mouse events on a .NET's WebBrowser, process them and prevent the WebBrowser from getting them. Is there any way to achieve this? I wonder if there is any way I can handle mouse events if the control is disabled. ...

Using BrowserSession and HtmlAgilityPack to login to Facebook through .NET

Hello, I'm trying to use Rohit Agarwal's BrowserSession class together with HtmlAgilityPack to login to and subsequently navigate around Facebook. I've previously managed doing the same by writing my own HttpWebRequest's. However, it then only works when I manually fetch the cookie from my browser and insert a fresh cookie-string to the...

Returning a file using asp.net mvc ?

I have a custom IHttpHandler which is used by thick clients to download files using a url such as http://url.ashx?id=123&version=456 the code handler basically ends with context.Response.WriteFile(myLocalServerPath); Is it possible to replace this using the typical asp.net mvc controller pattern ? ...

Access Hardware Information Using ASP.Net

Our PC Tech's are having to go around our company and write down information about every PC within the company (OS, CPU Speed, Memory). Is there any way to gather this information through ASP.Net? I know you can do it using Winforms, and i know there is also a security risk, but all that aside is it still possible? ...

Error Getting Cassini to work on Local Machine

I get the following error when attempted to get cassini to work on a local machine: The current identity (NT AUTHORITY\LOCAL SERVICE) does not have write access to 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files I actually created a BAT file to do the following cd\ cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50...

Troubleshooting database connection or windows console application die out without error

Synopsis - a windows console application extracting data from Excel spreadsheet then find match on oracle database if a record is found then update else create a record based on Excel's data. (Written in VB.net/.Net 3.5, use open source FileHelper library to process Excel and Oracle 10 as backend) Problem - a file with 983 records but o...

When to persist your business entities in your services classes

I have a method in my service where I create some entities, inside the method I call my repository's Add method so that the entities are persisted when I call my save method, should I call my Save method outside the service class or inside the method where I add the entities to the datacontext? ...

Best data model for a multi-tenant, multi-language application in .NET with SQL 2008

I am developing a multi-tenant application in .NET with SQL 2008. Each tenant can specify their own language. For instance, a Chinese company may use my application and want all of their data sorted and searchable via Chinese characters. And a German company may use my application and want all of their data sorted and searchable via G...

pause and resume Windows Media Player in C#

I'm making an VoIP application and I just want to be able to pause and resume (and probably check the player state) of Windows Media Player. Solutions I've found on SO refer to WMPLib but this is for embedding WMP in my .NET application. I simply just want to pause and resume the current instance if there is one. Is there documentation f...

Does .NET code run slower with the CLR debugger attached to the process?

Pretty much what the title says: I'm running a long program, and it has the CLR debugger attached, so I can catch and inspect exceptions. Am I getting performance comparable to running it without the debugger, or is there a serious (2-10x or more) penalty I'm paying? ...

.net parallel computing on a computer cluster

I'm running some simulations using Task Parallel Library on .net 4. These simulations run well as parallel on my i7 cpu machine. If i want to utilize other idle PCs too, then what kind of tool or library should I use? Can TPL use other machines' resources if i properly set up? Or should I use something like MPI? ...

What is a sorted table in .NET metadata?

In the #~stream there is a 64-bit vector of sorted tables. But what makes a table sorted or not? The only thing that I can find in the official documentation is that 16 metadata tables must be sorted by either primary key or secondary key and lists them. Why even have a bit vector for this since this can determine by specification? And i...