.net

How to pass variable to SelectCommand of SqlDataSource?

I want to pass variable from the code behind to SelectCommand of SqlDataSource? I dont want to use built-in parameter types (like ControlParemeter, QueryStringParameter, etc) I need to pass a vraiable? the following example does not work <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionSt...

Password protection for ASP.NET web pages?

I am trying to implement the simplest shared 'files' folder for a website but wish to have a 'reasonable' level of access control - i.e no casual multimegabyte uploads from passing hoi-polloi. Users are given a password etc. They then log-in, once credentials are successfully checked, they are given one of two possible access rights - r...

Inheritancedemand and assigning permissions

With inheritancedemand, any derived classes must have the permission. Does this mean I can simply assign assert to a derived type? With the phrase "have the permission", what appropriate ways can I assign the permission? I assume this doesn't mean requesting permissions, which doesn't really mean the same thing anyway. Apologies if thi...

Dynamic LINQ on IEnumerable?

Hi, Say i need to filter a generic list with a dynamic query (List<string> l; var x = l.Where(*dynamic query*)) How would i do this using LINQ? (Currently using a row filter on a dataview) I've seen a posting by scott g: but it appears to not work with objects that use IEnumerable (generic lists included) Can anyone offer any ideas?...

Unit Testing an AJAX Enabled ASP.NET MVC Web Site

I just got my first Unit Test project working, and immediately ran into some problems. One of the nice details about the Unit Testing concept that were pointed out to me was that I won't have to mock up http-contexts or such in order to test my application. However, I have made use of the Request.IsMvcAjaxRequest() check in my controlle...

Is there a tool to allow inspecting .NET objects in a running process?

I was thinking about a tool to inspect objects at runtime, primarily for reverse-engineering and I'm wondering if such a thing exists. The way I was thinking about it was that you had two views, a graph of objects and a class list. From the class list, you can select a class and see the instances of it, either in a list or in the graph...

How do you stop windows from resizing and moving your window?

When I try to move my window(with a mouse) above my screen so that the title bar would be hidden windows will move it back. And If I try to rezise the window larger then the screen space, windows will resize it back to "fit" the screen resolution. It seems that windows is sending a wm_move message if it does not like the size or positio...

Optimization techniques in C#

I am wondering what kind of optimization techniques people often use nowadays. I have seen people do caching all the time with dictionary and all. Is the trading space for speed the only way to go? ...

What clever things have you done with an ASP.NET MVC Action method

The ASP.NET MVC controller action methods are primarily used for handling 'business' operations but it can be used for lots more. I thought it would be fun to see what creative, useful things people have created actions for that may be practical or useful for others. Here's my contribution : Javascript file concatenator - to reduce nu...

Are there any mocking libraries that support the .NET Compact Framwork.

I was just wondering if anyone has found a mocking library that can be used with the .NET compact framwork. I have tried Moq but it doesn't seem to work, I did a quick Google search but couldn't find anything useful. Thanks. ...

How to serialize an Exception object in C#?

Hello all, I am trying to serialize an Exception object in C#. However, it appears that it is impossible since the Exception class is not marked as Serializable. Is there a way to work around that? UPDATE: If something goes wrong during the execution of the application, I want to be informed with the exception that occurred. My first r...

Should I be using a moq just to test if a method is called?

I have some test code that looks like this: [Test] public void RunTableInfoCommandShouldCallTableINfoWithName() { string expectedcommand = "TableInfo(TestTable,1)"; Table.RunTableInfoCommand(mockmapinfo.Object, "TestTable", TableInfoEnum.TAB_INFO_NAME); //This is just an en...

Products Similar to Progress AppServers

I work in Progress ABL and use what we call AppServers. Application Servers, processes that can talk to a Progress database and run business logic on the on a server and then send a response back to the client. These come in 4 modes but I'm most accustomed to state-reset which is an appserver that preserves state throughout the connecti...

Compare Two .NET Array objects

I am trying to compare two .NET arrays. Here is an obvious implementation for comparing arrays of bytes: bool AreEqual(byte[] a, byte[] b){ if(a.Length != b.Length) return false; foreach(int i = 0; i < a.Length; i++) if(a[i] != b[i]) return false; return true; } A more refined approach can be s...

How can I get this XML Structure

I have a web service that has an input object similar to the following. public class MyInput { [System.Xml.Serialization.XmlArrayItem("Demographic")] public DemographicsInfo[] Demographics {get; set;} } With the definition of the DemographicsInfo class like this. public class DemographicsInfo { [System.Xml.Serialization.X...

Customizing IQueryable<T>

I'm trying to customize entities of my application to make them have a property referencing the DataContext that loaded them. I think the best way is to somehow create a class that implements the IQueryable and set the entity datacontext property in its GetEnumerator method. My question is, how can I use the Provider and Expression use...

Library for parsing XHTML files with XLINQ

When I realized I needed to create an index for approximately 50 XHTML pages, which may be added/deleted/renamed/moved in the future, I thought "No problem -- I'll write a quick index generator using LINQ to XML, since XHTML definitely counts as XML". Of course, as soon as I tried running it, I found out about the fact that XLINQ choke...

Watin in TFS?

I'm trying to get my WATIN tests to work in TFS2008 (continuous integration) as part of a nightly build. All tests work fine on my local machine (from VS2008), and my unit tests (non-watin) work great locally, as well as in TFS. to illustrate what we're doing I've got a simple test: [TestMethod] public void Watin() { ...

What's the right way, for testability, to add functionality to a ComboBox?

The desired functionality of the 'enhanced' combo box is a quick find method. Each item in the combobox has a ToString() method, such that they can be displayed in the drop down list. On clicking an item in the drop down list, the combobox's observers are notified of the selection. Also, every time the typed text in the combobox changes...

Calling Select() on WPF text box doesn't do anything.

I'm using a WPF TextBox, and I'm calling the Select() method to make a selection. Unfortunately, it doesn't seem to work unless I select something manually first. Can someone suggest as to why it happens? ...