asp.net

What content type to force download of text response?

I need to stream a file to the Response for saving on the end user's machine. The file is plain text, so what content type can I use to prevent the text being displayed in the browser? ...

How to meake file upload control with resume in ASP.Net ?

How to make ASP.net file upload control with resume, without file size limitation and with secure connection? Any idea? ...

C# - How to change HTML elements attributes

Hi, My master page contains a list as shown here. What I'd like to do though, is add the "class=active" attribute to the list li thats currently active but I have no idea how to do this. I know that the code goes in the aspx page's page_load event, but no idea how to access the li I need to add the attribute. Please enlighten me. Many t...

Large File Download - Connection With Server Reset

I have an asp.net website that allows the user to download largish files - 30mb to about 60mb. Sometimes the download works fine but often it fails at some varying point before the download finishes with the message saying that the connection with the server was reset. Originally I was simply using Server.TransmitFile but after reading...

How to create a route like "/x/{*path}/y" in ASP.NET routing?

I have routes like "x/{*path}" where the path parameter is used by the controller to navigate a tree structure to end up with a resource which is served to the client. I would now like to extend this scheme in an orthogonal fashion with other controllers that provide other "aspects" of the resource such as meta-data or a thumbnail. It s...

How to get all the controls in page using javascript in ASP.net page.

I am having a page with tab control and each control has almost 15 controls.totally there are 10 tabs. totally there are about 150 controls in a page(controls like drop down list, textbox, radiobutton, listbox only). My requirement is there is button(submit) at the bottom the page. I need to check with javascript that at least 3 options...

log4net not logging ThreadContext

I have log4net running on my AsP.NET site. I'm able to log messages to my DB Table, but it isn't logging the ThreadContext properties. For example: ThreadContext.Properties["Url"] = HttpContext.Current.Request.Url.ToString(); ThreadContext.Properties["HttpReferer"] = HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]; My log4...

LinqtoSQL and problems

I am using link to sql, I have a connected set of objects. I start out and do a linq statement like this Dim L= from II in context.InventoryItems select II Dim L2 = L.tolist The second line was so that I could narrow down where the problem was occuring. When the second line is hit I get an error "The EntitySet is already loaded and t...

FormView_ItemUpdating in not updating

I am using a FormView to update an existing SQL Server record. The rows from the sqldatasource display fine in the FormView and I can edit them. When I click Update, I get the ItemUpdating event but not the ItemUpdated event and the revisions are not written to the database. Can anyone help me in this please. ...

How can I use the button tag with ASP.NET?

I'd like to use the newer <button> tag in an ASP.NET website which, among other things, allows CSS-styled text and embedding a graphic inside the button. The asp:Button control renders as <input type="button">, is there any way to make a preexisting control render to <button>? From what I've read there is an incompatibility with IE post...

Does ASP.net health monitoring work with asmx web services

I'm trying to use ASP.net health monitoring to log unhandled exceptions from an asmx web service. I've enabled health monitoring in the web.config but it's not logging anything. Does health monitoring work with asmx web services? I've googled around and seems other people have asked the same question but never got a definite answer. ...

Best way to have a live readable config file in Asp.Net.

I need to tweak some variables (only in a development setting) without having to restart IIS or anything (so I assume Web.Config is the wrong place to put them). Where is the easiest place to put about 500 config settings that have to be read for every request and written to, like I said, while IIS is running? EDIT: Like I said, this ...

What Does the DRY Principle Actually Look Like in ASP.NET MVC?

I keep hearing about the DRY Principle and how it is so important in ASP.NET MVC, but when I do research on Google I don't seem to quite understand exactly how it applies to MVC. From what I've read its not really the copy & paste code smell, which I thought it was, but it is more than that. Can any of you give some insight into how I ...

Adding click event to button to fire javascript, through VB.NET

Hi, I have an ASP.NET page which pulls a set of images from a database table, and using an enumerator, goes through all of them and displays then. This all happens in the codebehind (VB.NET), where the code adds the placeholder and some controls inside tables (tables inside the placeholder). I've added a button to this placeholder (in...

NHibernate database connections failing under load

Hi, I was wondering if this seemed to familiar to any experience NHibernate developers or if someone could give me an idea as to where to start to try and resolve this issue: I inherited an NHibernate site written in ASP.NET 1.1 using NHibernate 0.6 and .NET remoting to the DAL layer residing on the database server. I have been trying ...

Creating an asp:button programatically

Hi, I'm using my code-behind page to create a save button programatically: Button btnSave = new Button(); btnSave.ID = "btnSave"; btnSave.Text = "Save"; However I think this must create an html button or perhaps needs something else as I cannot seem to set the OnClick attribute in the following line, I can specify OnClien...

UnauthorizedAccessException with IIS7

I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception: UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied." I have given write access to the iis_iusrs, iis_wpg, and aspnet users, based on various advices found by Google, but still get the er...

Programmatic solution to change navigation id to highlight current page ASP.NET

I am writing a website with Visual Studio 2008 and ASP.NET 3.5. I have a masterpage set up to simplify the layout and to keep the content pages for content rather than content and layout. The navigation is list, css'd so it looks like a bar. In order to highlight the page on the bar, the list item needs to look like this <li id="curren...

Add a CheckBox column to a GridView with persistence

I have an ASP.NET application that displays various views into a largish database of protein sequences. As a visitor browses the data, I'd like for them to be able to select a CheckBox in the GridView row to flag sequences for later download as a zipped text file. I don't want to store the selections so they should just be valid for th...

how can an .ASPX page get its file system path?

I have a page something.aspx, with associated codebehind something.aspx.cs. In that codebehind, I want to know the filesystem location of something.aspx. Is there any convenient way to get it? Update: I got several excellent answers, which unfortunately didn't work because of something else crazy I'm doing. I'm encoding some addition...