asp.net

How do you access Control.ViewState with a dynamically added Control subclass?

We have created a control that needs to persist data via the ViewState property of the Control class. Our class subclasses control strictly to get access to the ViewState property (it's protected on the Page object). We are adding the control to Page.Controls in OnInit, and then attempt to set the ViewState property in OnPreLoad. When w...

Impersonating a User in Asp.Net

My DBA requires all database access to be done through trusted domain account. This can be done if you set the web.config . This requires the user to login or to be on the domain for IE pass the credentials through. I want to impersonate a user by using code. I am using the code found in this knowledgebase article: http://support.m...

GDI+ System.Drawing.Bitmap gives error Parameter is not valid intermittently

Hi all, I have some C# code in an ASP.Net application that does this: Bitmap bmp = new Bitmap(1184, 1900); And occasionally it throws an exception "Parameter is not valid". Now i've been googling around and apparently GDI+ is infamous for throwing random exceptions, and lots of people have had this problem, but nobody has a solution to...

Performance penalty on putting classes in aspx and ascx codebehinds

What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to unit test, code is not reusable, etc.), but it does come in very handy when you're dealing with classes t...

ASP.net MVC HomeController URL

By default the MVC Preview 5 web project comes with a HomeController.vb class. This sets the web URL to http://www.mywebsite.com/home/ by default. If I just wanted this to be http://www.mywebsite.com/ by default, how would I accomplish that? ...

Writing a cookie from an ASP.Net HTTPHandler - Page.Response object?

Hey all, I am creating an HTTP handler that listens for calls to a specific file type, and handles it accordingly. My HTTP Handler listens for .bcn files, then writes a cookie to the user's computer and sends back an image... this will be used in advertising banners so that the user is tagged as seeing the banner, and we can then offer...

What am I missing by not moving my ASP.NET 2.0 site to ASP.NET 3.5?

I have a web application using ASP.NET 2.0 and I want to know if I should be moving it to ASP.NET 3.5, particularly... what am I missing by not moving to ASP.NET 3.5? I understand the disadvantages, but I don't understand the advantages. What are the biggest benefits of migrating/rewriting? Will I get a speed improvement? Is MVC tha...

HTTPHandler tag in Web.Config breaks asmx Files...

hey all, In my ASP.Net 1.1 application, i've added the following to my Web.Config (within the System.Web tag section): <httpHandlers> <add verb="*" path="*.bcn" type="Internet2008.Beacon.BeaconHandler, Internet2008" /> </httpHandlers> This works fine, and the HTTPHandler kicks in for files of type .bcn, and does its thing.. however...

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario. But i cannot get UpdatePanel to work and cant seem to find out why I have in fact reverted to a very simple example to validate it is not my code: http://ajax.net-tutorials.com/controls/updatepanel-control/ In this example I click on either button and both text links update. ...

How do I create an installer for a .Net website, Windows Service, and more???

I need to create an installer program that will do install the following: ASP.Net Website Windows Service SQL Express if it isn't installed and the user doesn't have a SQL Server Dundas Charts ASP.Net AJAX v.1.0 ReportViewer control (for 2.0 Framework) Check Framework prerequisites (2.0) Configure IIS and app.config (data connection s...

How do I change the maximum Upload File Size for the Document Manager in a Telerik RAD Controls RADEditor/WYSIWYG control?

Hi, I'm using the Telerik RAD Controls RADEditor/WYSIWYG control as part of a Dynamic Data solution. I would like to be able to upload files using the Document Manager of this control. However, these files are larger than whatever the default setting is for maximum upload file size. Can anyone point me in the right direction to fix t...

Are there naming conventions for ASP.NET web application directory structures?

Currently I am developing a site with about seven partial classes, a few icons, three pages and an App_Themes folder. I was interested to know, is there an industry standard directory structure for anything larger than a small project? For example, I want to keep the classes in separate folders, the images in separate folders etc. My cu...

Asp.net hosting provider with build capabilities and source control

Can you suggest an asp.net 3.5 hosting provider with continuous integration (cctray – nant builds) and source control facilities (svn)? My requirement would be something like this: I checkin to a svn branch (say trunk) on the hosting provider space. CruiseControl.NET on the server fires off a build. I see success/failure on my cct...

How do I get user informations from a session id in ASP.NET ?

Hi, In an asp.net application, i would like to use a webservice to return the username associated with the session id passed as a parameter. We're currently using InProc session store. Is it possible to do this ? Edit: what i'm trying to do is get information about another session than the current one. I'm not trying to get the Sessio...

Is it possible to upload entire folders in ASP.NET?

The file upload control in asp.net does not allow me to select a folder and enables me to select only the files. Is there any way in which I can select a folder (obviously without using the file upload control). Why I want to select the folder is basically to store its entire path in a database table. ...

.NET Configuration (app.config/web.config/settings.settings)

I have a .NET application which has different configuration files for Debug and Release builds. E.g. the debug app.config file points to a development SQL Server which has debugging enabled and the release target points to the live SQL Server. There are also other settings, some of which are different in debug/release. I currently use t...

Exception handling using an HttpModule

We're reviewing one of the company's system's exception handling and found a couple of interesting things. Most of the code blocks (if not all of them) are inside a try/catch block, and inside the catch block a new BaseApplicationException is being thrown - which seems to be coming from the Enterprise Libraries. I'm in a bit of a troub...

Adding ListItems to a DropDownList from a generic list

I have a this aspx-code: (sample) <asp:DropDownList runat="server" ID="ddList1"></asp:DropDownList> With this codebehind: List<System.Web.UI.WebControls.ListItem> colors = new List<System.Web.UI.WebControls.ListItem>(); colors.Add(new ListItem("Select Value", "0")); colors.Add(new ListItem("Red", "1")); colors.Add(new ListItem("Green...

Can "classic" ASP.NET pages and Microsoft MVC coexist in the same web application?

I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time... ...

Method 'XYZ' cannot be reflected

We have consumed a third party web service and are trying to invoke it from an ASP.NET web application. However when I instantiate the web service the following System.InvalidOperationException exception is thrown: Method 'ABC.XYZ' can not be reflected. System.InvalidOperationException: Method 'ABC.XYZ' can not be reflected. -...