asp.net

asp.net: moving from session variables to cookies

My forms are losing session variables on shared hosting very quickly (webhost4life), and I think I want to replace them with cookies. Does the following look reasonable for tracking an ID from form to form: if(Request.Cookies["currentForm"] == null) return; projectID = new Guid(Request.Cookies["currentForm"]["selectedProjectID"]); Re...

Visual Studio 2008 user controls registered in the web.config not registering with intellisense

I have a C# Web application built in Visual Studio 2008 where we rely heavily on user controls for 'pre-built' blocks of ASP.NET. Instead of registering a big stack of user controls on each page, we register all the controls in a local (to a specific folder) web.config file. The advantage is that we can use the controls and the pages lo...

When to use threading against a scheduled task/web methods

These two may look like they have no correlation but bear with me! In a previous version of the software I develop/maintain there was a web app sitting on top of a web service. There was a scheduled task that run every hour called one of the web methods to carry out some tasks. In the new architecture we now have a web application pr...

How to Access ASP control located in a user control via JavaScript

Hi All, I'm designing a user control, briefly it contains an asp:hiddenfield control, i'm going to access it via JavaScript function like this function doAnyThing { var myVar = document.getElementById("myHiddenFiled"); } but when I trace my code I found myVar assigned to null, does it matter document.getElementById() method i...

SqlBulkCopy Not Working

I have a dataSet populated from Excel Sheet. I wanted to use SQLBulk Copy to Insert Records in Lead_Hdr table where LeadId is PK. I am having following error while executing this code The given ColumnMapping does not match up with any column in the source or destination string ConStr=ConfigurationManager.ConnectionStrings["ConSt...

Asp.Net General Local Resource tool for user control

When I use the Visual Studio menu Tool -> Generate Local Resource, it changed aspx file by adding meta attributes to controls. But it doesnt do so for user controls that I have created. For example, If I have used a control in the page <myControl:SpecialLabelControl ID="myLabel" runat="server" Text="Localize Me!" /> I want "Localize ...

ImageClickEvenHandler doesn't call handler

i have a dinamically created table and in some of the cells i have an image button associated with the redBall_Click() handler (here is the code behind) TableCell cellOK = new TableCell(); cellOK.Style.Add(HtmlTextWriterStyle.TextAlign, "Center"); cellOK.Width = new Unit("3%"); ImageButton redBall = new ImageButton(); redBall.C...

Open File Dialogue box in JavaScript

Hey all, how can I get an "open file dialogue" box in Javascript? ::) Thanks in advance :) Edit: Duplicate of: open-file-dialogue-box-in-javascript and javascript-file-uploads ...

handling CSS & Images in ASP.NET MVC

Hi I am developing a simple application based upon ASP.NET MVC. I have altered the default master.css to my have my own styles. Now the only problem is that i am adding background-image property to my one of my UL->Li->A to create menus. It is working fine in firefox but the images are not showing up at all in Internet explorer (IE7/8). ...

ASP.NET Events not firing in page containing large GridView control

I have a GridView control on an ASP page, which I've bound to a large(ish) datasource (about 10k rows, with 24 varchar(50) columns). The page also has a seperate (i.e. not in the GridView) button control. The problem is; clicking on the button doesn't appear to fire either the PageLoad or the Button___click events, all I get is a 'Canno...

Do I need to set debug="false" in my ASP.NET web app before I use the "Publish Web Site" feature in VS 2005?

Basically, what I'm wondering is if I need to set debug="false" before hitting the "Publish Web Site" button or if I can switch it after all the files have been published. ...

Mysterious process - RunSilent - error on Windows Server 2003

We are setting up production servers (Windows Server 2003 R2 64-bit) for a web application that uses the Dundas Maps for ASP.Net component. After installation we receive the following error: "RunSilent has encountered a problem and needs to close." The question is, what on earth is RunSilent? A google search gets nothing of interest b...

UserControls Classname-Namespaces issue

I want to change Control(@Control) directive in a way to make it redistributable and want to use ClassName attribute so I changed this From : <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductShower.ascx.cs" Inherits="MyCompany.Web.Controls.ProductShower" %> To : <%@ Control Language="C#" ClassName="MyCompany.Web.C...

How do I call an AuthenticationService from a login control?

I have a solution with 2 projects. In the first project a I have a website with a Logon Control. In the second project I have a WCF project with an AuthenticatonService configured. What is the easiest way to integrate both? In other word, How do I call the Authentication Service from the login control? EDIT: OK, what I mean is that by ...

How do I add an empty first entry do an <asp:DropDownList>?

I have a dropdown, I have a datasource, I have AutoPostBack set to true. I want to add a first entry to the datasource that says something like "--- select country ---" and selecting this entry won't cause postback. This feels like it should be easy to do, yet I can't seem to be able to find a good solution. Thanks. ...

What are some best practices / conventions / guidelines for ASP.NET or C#?

Long ago I read a great book on C# and Visual Basic best practices: Practical Guidelines and Best Practices for Microsoft Visual Basic and Visual C# Developers by Francesco Balena, Giuseppe Dimauro This book was very helpful to me in its time, which dates back to ASP.NET 1.1. Please list some current best practices for ASP.NET, C#, ...

Is there any way to avoid duplicate page cache entries while allowing for case-insensitive URLs?

If I have a page with outputcaching (let's call it Employees.aspx) which accepts one parameter (through querystring) called Company like this: http://www.example.com/Employees.aspx?Company=Google How can I avoid duplicate page cache entries for differently cased URLs like: http://www.example.com/Employees.aspx?Company=GOOGLE http:/...

Page only posts back with Fiddler attached?

I have Reporting Services set up with Forms Authentication. Our app is sitting over Reporting Services and uses it's authentication extension as a Single Sign On. We have a simple logon page that we've got working in the past but on this one machine it refuses to post back when the logon button is clicked. I have Trace information inser...

How to run JavaScript prior to System.Web.UI.Timer OnTick?

I need a client-side script to confirm that the Timer's OnTick event can proceed. How do I invoke CanContinue() before the Timer1 postback occurs? How do I cancel the postback if user selects Cancel? <%@ Page Language="C#" %> <script runat="server"> protected void Timer1_OnTick(object sender, EventArgs e) { Response...

Is it better to convert existing user accounts for them or have the users re-register?

I'm rewriting a website and going from a home-grown authentication model where users logged in with their account id (numbers) and password, to .NET FormsAuthentication where users will login with a username that they choose (or is available) and a stronger password. There are over 38K existing accounts and I'm trying to decide if the ex...