asp.net

Specifying filename for dynamic PDF in asp.net

How can I specify the filename when dumping data into the response stream? Right now I'm doing the following: byte[] data= GetFoo(); Response.Clear(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.BinaryWrite(data); Response.End(); With the code above, I get "foo.aspx.pdf" as the filename to s...

Architect Database to Allow App To Use Windows Integrated Auth or FBA

I'm writing a web app that will be distributed and I want to allow the installer to choose between using Integrated Authentication, or FBA. Switching between those with web.config is obviously very easy. I'm trying to decide how best to architect the database and code to accept either a windows-sid or a UserID from the aspnetdb. For e...

Remove columns from DataTable in C#

I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data. Is there a way to remove those columns that I don't want, copy the DataTable to another that has only the columns defined that I want or is it just better to iterate the collec...

Best way to implement Google Custom Search on an aspx page

Google custom search code is provided as a form tag. However, Asp.net only allows a single form tag on a page. What is the best way to implement their code so you can include it on an aspx page (say as part of a Masterpage or navigation element). ...

"Could not reformat the document" in ASP.NET, VS2008

I'm in an ASP.NET UserControl. When I type Control-K, Control-D to reformat all the markup, I get a series of messages from VS 2008: "Could not reformat the document. The original format was restored." "Could not complete the action." "The operation could not be completed. The parameter is incorrect." Anybody know what causes this...

SelectedIndexChanged event handler getting old index

I'm handling the onSelectIndexChanged event. An event is raised when the DropDownList selection changes. the problem is that the DropDownList still returns the old values for SelectedValue and SelectedIndex. What am I doing wrong? Here is the DropDownList definition from the aspx file: <div style="margin: 0px; padding: 0px 1em 0px 0px;...

Sys is undefined

I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "Sys is undefined". It doesn't happen all the time, but it is reproducible. When it happens, the user has to shut down their browser and r...

ASP.NET Custom Controls - Alternatives to PostBack?

On my journey into the depths of custom ASP.NET control development I am obviously getting my head around the ASP.NET PostBack model and how it affects control development. I understand that controls have no "lifetime" in ASP.NET, and therefore must be re-initialized on each and every page load. We overcome this by persisting the object...

How to determine if the user's browser can view PDF files

What's the best way for determining whether the user's browser can view PDF files? Ideally, it shouldn't matter on the browser or the operating system. Is there a specific way of doing it in ASP.NET, or would the answer be just JavaScript? ...

IIS Authentication across servers

My production environment involves a pair of IIS 6 web servers, one running legacy .NET 1.1 applications and the other running .NET 2.0 applications. We cannot install .NET 2.0 alongside 1.1 on the same machine because it is a tightly-regulated 'Validated System' and would present a bureaucratic nightmare to revalidate. Websites on bot...

Edit source code when debugging

I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already running process or the code ...

Creating a DNN Module that uses a end-user modifyable template

I'd like to create a module in DNN that, similar to the Announcements control, offers a template that the portal admin can modify for formatting. I have a control that currently uses a Repeater control with templates. Is there a way to override the contents of the repeater ItemTemplate, HeaderTemplate, and FooterTemplate properties? ...

How does the Multiview control handle its Viewstate?

Does the Multiview control contain the viewstate information for each of its views regardless of whether or not the view is currently visible? ...

How do I TDD a custom membership provider and custom membership user?

I need to create a custom membership user and provider for an ASP.NET mvc app and I'm looking to use TDD. I have created a User class which inherits from the MembershipUser class, but when I try to test it I get an error that I can't figure out. How do I give it a valid provider name? Do I just need to add it to web.config? But I'm n...

What is the best way the _DoPostBack javascript method in Asp.net

I want to set a breakpoint on the __DoPostBack method, but it's a pain to find the correct file to set the breakpoint in. The method __DoPostBack is contained in an auto-generated js file called something like: ScriptResource.axd?d=P_lo2... After a few post-backs visual studio gets littered with many of these files, and it's a bit of ...

SWFAddress Deeplinks and C# library?

Is there a C# class for interacting with SWFAddress deeplink URL strings (reading deeplink parameters, building SWFAddress URLs, etc.)? Planning to write one myself otherwise; but I wanted to make sure I wasn't reinventing the wheel first. ...

How to make any arbitrary SECTION of ANY aspx webpage available as an Ajax popup

I wonder if anyone can think of a good technique to enable any arbitrary section of an aspx page (say, the contents within a specified DIV tag) to be able to be called and displayed in an ajax modal popup? (So, only a certain section of the page would be displayed) For example: 1) You have a large application with many entities (Custome...

How to convert all controls on an aspx webform to a read-only equivalent

Has anyone ever written a function that can convert all of the controls on an aspx page into a read only version? For example, if UserDetails.aspx is used to edit and save a users information, if someone with inappropriate permissions enter the page, I would like to render it as read-only. So, most controls would be converted to labels...

What to put in a session variable

I recently came across a ASP 1.1 web application that put a whole heap of stuff in the session variable - including all the DB data objects and even the DB connection object. It ends up being huge. When the web session times out (four hours after the user has finished using the application) sometimes their database transactions get rolle...

SSRS 2005 Matrix and border styles when exporting to XLS

The Matrix in SSRS (SQL Server Reporting Services 2005) seems to have issues with certain the border styles when exporting to XLS (but not PDF or web view; maybe other formats, not sure?). For example: Create a matrix and set the Matrix border style to Black Solid 1px, but all 4 of the cells to have a border style of Black None 1px. Whe...