asp.net

How can I see the validation results while in a controller's action?

I have an update action in a controller that performs an UpdateModel. Before I pass the data back to the view I want to log the properties that failed to validate. I expected the dictionary where the errors are stored to be in the ModelState (since the method AddModelError() is there) but this doesn't seem to be the case. How can I ac...

What is the difference between a Gridview's DataKeys property and DataKeyNames?

They seem to be equal. Can both have multiple keys separated by a comma. ...

Shared Authentication, Membership & Roles across DNN and ASP.net applications

Here's my situation. I have a DotNetNuke application. I want to link to an existing ASP.net website from within the DNN website, and have decided to use DNN's IFrame for that. The existing ASP.net application uses Forms Authentication for security - only authorized users can access the pages. This asp.net application also requires...

Mysterious IIS Problem: Site stops serving dynamic pages, no errors in logs

Hi all, This may be the most mysterious problem I've ever encountered. We have an IIS7 install with 3 Web Sites on it, each with it's own Application Pool. Once a day, for about an hour, a specific one of them goes down. What I mean by "goes down" is: It stops responding to requests for dynamic pages (ex. default.aspx) but will ser...

How to read resource of asp.net page from utility class

I need to get a string from resource file of page from utility class. I tried ResourceManager resources = new ResourceManager( "Company.Application.Folder.App_LocalResources.Page.aspx", Assembly.GetExecutingAssembly()); string value = resources.GetString("ResourceName"); ...

asp.net - passing generic lists

I have a utility class that takes a generic list as a parameter. Code looks like: Function DoStuff(collection as Object, elt as Object) ... collection.Add(elt) ... End Function This is called with: DoStuff( List(Of Foo), new Foo() ) DoStuff( List(Of Bar), new Bar() ) There are about a dozen different types. Currently, pa...

Asp.NET / VB.NET: Getting the path from the URL / URI ?

Hello, Say I have a project that I am deploying at www.foo.com/path1/default.aspx and www.foo.com/path2/default.aspx What would be the most reliable way to know if I was in the folder "path1", or "path2"? Can I grab that directly, or do I need to split() somehow on the Request.Url.AbsolutePath, or... ? I just want to change co...

asp.net FileUpload event after choice is made and before submit for upload

I would like to display the size of the file that was chosen via the Browse button of the FileUpload control. Ideally, this value is displayed immediately after the user chooses the file but BEFORE the "Upload File" Button is clicked. I have and on a webform. The Button looks like this: <asp:Button ID="UploadButton" runat="server"...

drop down list with jquery and blockui

I almost figure this out, can anyone tell me as to why my $.unblock never executes? $(document).ready(function() { $('#somedropdown').change(function() { $.blockUI({ css: { border: 'none', padding: '15px', backg...

Is it worth it to enable dynamic compression in IIS7 ?

I am trying to find all possible ways I could improve my website performance. I was considering enabling dynamic compression at the server level but was concerned by performance hits (no caching of compressed pages - corruption of files - overhead on the server). Should I just give up on the dynamic compression with IIS 7? are there modu...

AspNetSqlMembershipProvider asp:PasswordRecovery: How to set the password complexity?

We are using the AspNetSqlMembershipProvider control to generate new passwords. Is there anyway to turn down the complexity of the generated passwords? By default it is outputting things like this: *f.;tp{h|[hPCF I realize I could roll my own password recovery process if I have to, but I'd like to avoid that. ...

How to get route "name" when in route controller

I'm using routing in asp.net to get nice URLs When I define routes in global.asax I create two distinct routes that use the same controller (c#): // Setup code for route a... routes.Add("routeb", routea); // Setup code for route b... routes.Add("routeb", routeb); (How) is it possible to determine from...

Javascript working with ASP.NET code behind

I have to make a delete button for a simple intranet forum. I would like to have a javascript alert box (or equivalent) asking for confirmation when deleting posts. However, I've found it difficult to get the result of the javascript confirmation box to feed into the code-behind. Is this even possible? Or do I have to use another sor...

ASP.NET Web Site Administration Tool Security tab shows error 1802

I'm following this walkthrough: http://msdn.microsoft.com/en-us/library/879kf95c(VS.80).aspx In a machine running vista ultimate, I have installed: IIS SQL Server Express 2005 Visual Studio 2005 I created a new website and I can access it ok via http://127.0.0.1 but I want to learn to create a login and have user memberships. W...

Send values from other controls to User Control properties in .aspx page

Is there a way pass values from other controls (e.g. "selected value of dropdownlist", "value from query string") to a User Control using a property within the tag itself and NOT from the code behind? ...

ASP.NET Save HTML Sent to Browser

I need to save the full and exact HTML sent to the browser for some transactions (for legal tracking purposes.) I suspect I am not sure if there is a suitable hook to do this. Does anyone know? (BTW, I am aware of the need to also save associated pages like style sheets and images.) ...

"The remote host closed the connection" in Response.OutputStream.Write

This code streams large files to our users: // Open the file. iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read); // Total bytes to read: dataToRead = iStream.Length; // Read ...

Creating html attachment from xslt, encoding issues, asp.net

I am trying to create an html attachment by processing some of my xml through an xsl transform and sending it to the client. If I click "open", IE shows the html properly, but if I save the attachment and then open it in Firefox, every place there was a   I'm getting a "Â" character. I have a feeling this has to do with our encoding. Her...

Help catching StackOverflowException with WinDbg and ADPlus

Short Version I want an ADPlus script that will do a full memory dump on the first-chance StackOverflowException, before anything is cleaned up, and ignore all other exception types. Log Version After a release of new ASP.NET code, we started getting intermittent StackOverflowExceptions. We've looked for infinite recursions and all t...

I am trying to learn how to bind an IEnumerable LINQ collection to a repeater

I have created an IEnumerable list of racing drivers using LINQ from a string array as such below: string[] driverNames = { "Lewis Hamilton", "Heikki Kovalainen", "Felipe Massa", "Kimi Raikkonen", ...