asp.net

How do I change the security paradigm for the MembershipProvider?

I'm wrestling with building a custom membership provider that allows me to have the security scheme I need. I have my own IPrincipal, IIdentity, and MembershipProvider. I have the authentication working fine. The problem I'm running into now is the authorization. The problem I have with the authorization scheme is inherintly in the I...

How to simulate multiple inheritance for ASP.NET base pages?

My project has been using a base page to hold common page functionality. Its worked until the base page grew to be huge, so I tried to factor the base page into several classes. Then I realized that I can't write public MyPage : SecurePage, PageWithGridViewSorting, PageWithSessionWarning given something like: public class SecurePa...

Gridview row information disappearing after selectedIndexChanged

I have a master/details setup with a GridView and DetailsView both in UpdatePanels. When the DetailsView is edited and updated, I want these changes to be reflected in the GridView, but without rebinding that data (which could change the selectedItem's sort order among other problems it causes) On DetailsView ItemUpdated I have the fol...

How do I bind an ASP.NET FormView to a single record?

The whole purpose of the ASP.NET FormView control is to display a single record at a time. So how do I bind it to a single record? It complains that Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource. I can wrap my object in a list if that's the only solution. In this application, the For...

How do I use Optional Parameters in an ASP.NET MVC Controller

I have a set of drop down controls on a view that are linked to two lists. //control ViewData["Countries"] = new SelectList(x.getCountries().ToList(), "key","value",country); ViewData["Regions"] = new SelectList(x.getRegions(country).ToList(), "id", "name", regions); /* on the view */ <% using (Html.BeginForm("","", FormMethod.Get)) ...

Request.Form and radio button ids

I have the an approximation of the following input id='rb1' name='rb1' type='radio' input id='rb2' name='rb1' type='radio' e.g. both radios share the same name so only one can be selected I want to be able to use Request.Form to see which one has been selected. However all I get in Request.Form is the name e.g. rb1. Is there any way...

How to break an ASP.NET website down into modules that can be enabled/disabled?

I have an ASP.NET website with some independent sections. I need a way to turn on/off the different sections (each section is in it's own directory) based on the user selection. How can I prevent the users from accessing sections that are turned off? ...

Removing event from one link with seems to effect every thing

I have a window.onbeforeunload event that I wish to disable when I am clicking on a specific hyperlink. I am using the following JQuery: $(function() { $("a#<%= lockUnlock.ClientID %>").click(function() { window.onbeforeunload = null; }); }); But when I click on other links the event doesn't fire. Is the...

Exchanging data between xaml and aspx

Hi, I have a solution with MVC web application, WCF web service and Silverlight. MVC starts Silverlight and Silverlight gets the parameters using web service. Now I have to pass a variable from Silverlight to MVC (not with get/post). How can I do that? Thanks ...

Anyone know of good knowledgebase/faq software for asp.net c#?

I am looking for knowledgebase/faq software with a developer license that is written in c#. I have found a couple of good options for VB but would prefer C#. ...

Passing ViewData versus making a new class.

I've seen several posts on StackOverflow and elsewhere discussing the various ways to bring together data from multiple entities into a strongly typed view, these being using the ViewData object or constructing a new custom class that utilizes both entities. To me it seems that if you are representing some sort of new hybrid entity you ...

ASP.NET Cached page. State is saved but requires refresh

I have a webforms page that makes quite extensive use of AJAX. There are a number of links on it that take the user off to a different page. I want to maintain the state that the page was in should the user come back to it using the browser's back button. How I've gone about this is to store the page's state in session each time the use...

Is it possible to turn off IIS compression from application?

We've run into a problem with IIS compression screwing up IE6. We are stuck on a shared host and we can't turn compression off at the server level. Is it possible for us to turn off IIS compression from our ASP.Net application? ...

CSS div style - should I use class or id?

I have a repeater of div's that look a little bit like this: <div class="header_div"> <!-- Content --> </div> I want to have the background color of the divs change based on a dynamic property of the content of the div (lets call it the category), but I still want the "header_div" style to be assgined in cases where I dont have a ...

C# Shortest Way to Check for Null and Assign Another Value if Not

I am pulling varchar values out of a DB and want to set the string I am assigning them to as "" if they are null. I'm currently doing it like this. if (IsNullOrEmpty(planRec.approved_by) == true) this.approved_by = ""; else this.approved_by = planRec.approved_by.toString(); There seems like there should be a way to do this in a s...

Why Does FireFox Not Include the .xml Extension when Downloading a File?

OK. I'm sure it does download XML files with the .xml extension, but I'm wondering what is missing in the code here to cause the .xml extenstion to be missing from the downloaded file. Note: This works in IE 6+ (didn't try WebKit based browsers or Opera) private void GenerateXmlAttachment(string xmlInStringFormat, string fileName) { ...

Error getting directory entry from IIS on Win 7 RC1

I have code that works on Win XP (IIS 5.1) and Win Server 2008 (IIS 7.0) but fails on the Windows 7 release candidate, which runs IIS 7.5. I construct a new DirectoryEntry("IIS://localhost/w3svc"). The DirectoryEntry object returned by the constructor is no good. (Viewing members in debugger throws a COMException.) Has anybody been w...

Moving to client side, jQuery on ASP.NET

I'm building some simple web apps and using jQuery to call .net webmethods. The more I put together, the more I wonder where I draw the line between the aspx page and what I can produce with jQuery/jTemplate and a few ajax calls. It seems I can do everything on the client now, and easily too. At the moment I've just got one default.htm...

Accessing MasterPage object from an .aspx code-behind

I know we've done this before in another .aspx page that's using this master page. So I tried this in a new .aspx but for some reason, it is not recognizing the Master object. And the .aspx definitely is set to the master page in the page directive correctly and there's no errors to that effect: using System; using System.Collections.G...

ASP.NET Alternative to Shorty

Does anyone know of an ASP.NET alternative available for Shorty (http://get-shorty.com/)? ...