asp.net

WCF client in ASP.net Page

Can anyone advise of a good pattern for using a WCF Service from an ASP.net Page? It seems that if the lifetime of the Client(:ServiceModel.ClientBase) is not properly controlled that we get PipeException thrown. It currently exists as a field of the Page class, but is being reinstantiated upon each page request without being cleaned up ...

ASP.NET Session_End called immediately after Session_Start after a session timeout

I have handlers for my Session_Start and Session_End events. When I first start the application, everything works fine. If I leave the session and the standard timeout occurs, I watch my Session_End throw. I'm expecting that behavior. Let's say though, I come back after the timeout and refresh a page. The Session_Start method runs,...

Forms Authentication - How to verify username and pwd of inactive user?

I'm using forms authentication for an app that allows users to register but not active. We will send out an activation code via snail mail (long story) and the user can return with that info and activate their account. I want to create a page where the user can come back and enter their username, password and generated key to activate ...

How can I reset a asp.net form after postback?

I am trying after the btnCreate_OnClick event to reset the form to it's default value just like the first page_load. The problem is after PostBack, every textbox and other controls, reloads the ViewState value. I cannot deactivate viewstate because of server event on DropDownList selection. The only way I found so far is to Redirect to s...

Accounting Style string format in ASP.NET

I would like to know the easiest way to format a string as accounting style. I know how to format as currency using {0:c} but there are some differences in accounting style, for example, all the dollar signs will line up as well as all the decimal points, and negatives are expressed in parenthesis rather than with a "-" minus sign. You...

What's the difference between the WebConfigurationManager and the ConfigurationManager?

What's the difference between the WebConfigurationManager and the ConfigurationManager? When should I use one over the other? UPDATED I just looked at the WebConfigurationManager, and for some reason, you can't access the connection strings as you do in the ConfigurationManager (like an array). Can anyone tell me why MS made it like ...

Path from one website to another in Visual Studio debug mode

I have a solution with two websites (folder based) and two class libraries. I need to be able to dynamically set a path from one of the websites to the other. More specifically, I am setting the PostBackUrl property of an image button that is in a datagrid row. Building and setting the URL for the production environment is easy. But ...

How to set a hyperlink to a text box in code. - with other HTML tags

Hi My code i want to display in a textbox <a href="http://www.erate.co.za/CompanyProfile.aspx?ID=112"&gt; <img src="http://www.erate.co.za/CompanyAdd.bmp" alt="Go rate us on www.eRate.co.za" border="0" style="width: 136px; height: 88px" /></a> But i get the ID from a Reader like this reader.Item("ID").ToString Now i want to se...

Static data in an ASP.NET page - threadsafe?

The background to this question is that I need to use some user session data in a (static) WebMethod. I have created a static property that references the data I need like so: private static UserWebSession UserWebSession { get { return (UserWebSession)HttpContext.Current.Session["UserWebSession"]; } } I can then ca...

ASP.NET script "scheduling" question

I am looking for a way to have a script run every day at 5am to delete the contents of a Temp folder. The following is the method I am considering. I would appreciate any thoughts on this or suggestions for other methods. I want to keep everything local, so that there are no external dependencies from outside my account on Discount AS...

Why doesn't Content-Disposition header work in IE 8?

I'm trying to stream a text file (CSV) to the response, and the following code works perfectly in Firefox 3, but when I use IE, it looks like it wants to download the actual .aspx page, and complains that the file contents don't match the file extension or type. If I then choose to download the file anyway, it correctly downloads the CS...

HP Quality Center API + ASP.NET

Has anyone ever used ASP or ASP.NET to connect to HPQC via the API? Where can I find some examples of this interaction? Any direction on the matter would be greatly appreciated. ...

Accessing parent control from child control - ASP.NET C#

I have a parent user control with a label. On the parent's OnInit, I dynamically load the child control. From the child control, I will need to set the parent's label to something. Using the Parent property returns the immediate parent which is actually a PlaceHolder in my case. Theoretically, I can recursively loop to get the reference...

How to find the nested Asp:GridView within the following code?

I have the following structure in an aspx page: <asp:Panel ID="pnlCust" runat="server"> <asp:GridView ID="gvMaster" runat="server" OnRowCreated="gvMaster_RowCreated"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Panel ID="pnlMaster" runat="server"> ...

ASP.NET MVC Pass mutiple params from getJson to controller

Hi, I am making a call to a controller action in javascript using the getJson method. I need to pass two parameters to my action method on the controller, but I am struggling to do so. I do not fully understand the routing tables and not sure if this is what I need to use to get this working. Please see example below of what I am tr...

Using ASP.NET Compare Validator to make sure field is unique

I would like to use a Validator to guarantee that a given textbox's submitted content is unique. I want to make sure that the name put into the box is not the same as any other text box. The catch is I don't know at compile time how many other text boxes it will be compared to. It could be anywhere from 0 - n other name text boxes. Tha...

ASP.NET store Image in SQL and retrieve for Asp:Image

I am looking to fileupload a picture jpeg,gif,etc into an SQL database on an updateprofilepicture page. Then on the profile page, I want to retrieve the image from an sql database and have it show up in an Asp:Image control. I have much code trying to do this and it doesn't work. The table contains a column of type Image. ...

Cannot Use Microsoft Chart Control on a 64 bit Operating System

I am having issues running the chart control on our 64 bit machine. I get the following error... Could not load file or assembly 'AspnetChart' or one of its dependencies. An attempt was made to load a program with an incorrect format. The machine I am running this on is a Windows Server 2003 Enterprise x64 Edition SP2 Intel(R) Xeon...

Asp Binding question

Below is a some sample code I am trying to update. The client would like to make the menu item text an AppSetting Value. I have been able to setup the appsettings and the function to implement it. But I am getting an error on my Bind code and wondering if anyone see something I missed. Is it as easy as setting an ID tag for the Men...

ASP.Net validation summary causes page to jump to top

I have a simple form with a few required field validators and a validation summary control. When I submit the form, the client validation will cause the form to jump to the top of the page. If i remove the validation summary, the page does not move. Heres a quick example (pardon the line breaks): <br /><br /><br /><br /><br /><br /><...