asp.net

Variation in performance when using GetDirectories

I have a production performance issue that I'm stumped on. I'm hoping that someone has seen something similar or at least has a few troubleshooting techniques. I support an inherited asp.net web application that retrieves files from a shared network drive. One particular folder [we'll call it FOLDERA] I've chosen to troubleshoot again...

Dynamically Loading Controls and Persistence in ASP.NET

I am loading a series of controls in the Page_Load event. However, I have to recreate those controls each page load, which means storing their data elsewhere. This is cumbersome. protected void Page_Load(object sender, EventArgs e) { MyControl control = (MyControl)LoadControl(...); control.Initialize(GlobalClass.controlData); ...

Global.asax Error handling: Quirks of server.transfer

Hi, In my global.asax, I am checking for a 404, and transferring to the 404 error page as per the below: If HTTPExceptionInstance.GetHttpCode = 404 Then Server.ClearError() Response.TrySkipIisCustomErrors = True Response.Status = "404 Not Found" Server.Transfer("~/Invalid-Page.aspx") End If ...

ELMAH Error Signalling (ASP.NET)

I've got the code below up and running. It captures the user name and the browser that was used to access an intranet site. How can I modify the code so that ELMAH logs a specific StatusCode to the ELMAH_Error table in SQLServer? The eventual goal is the ability to extract out of the log these specific log entries to identify which PC's ...

JSON serializer and CSLA objects

We just started a new ASP.Net project that uses web services to serialize some CSLA business objects into JSON data for our client javascript/JQuery code. After reviewing the JSON data in the client browser(Firebug in Firefox) we notices that there are a significant number of properties from the business object that we do not need downl...

Best way to set master page properties in content page in asp.net?

There are different ways to set the title for content pages from Master page by findcontrol by creating property in master page and setting the value in content page As both method requires an object creation of master page which will be little heavy myMasterPage myMaster = (myMasterPage)this.Master; so I have tried it by creating ...

Prevent Gmail Threaded Conversation on Notification emails

This question is the opposite of http://stackoverflow.com/questions/372449/header-in-gmail-for-thread-hinting I have a system that generates notifications for various things. A lot of these have the same subject line, but different content. Is there anyway short of adding some kind of unique token in the subject line of forcing the ema...

When do you use If (!IsPostBack) in ASP.NET?

The more I use ASP.NET, the more if (!IsPostBack) {} seems pointless... First example: For example, I just Googled an issue, they said use this as part of the solution: if (!Page.IsPostBack) { Page.LoadComplete += new EventHandler(Page_LoadComplete); } Which does exactly as coded, LoadComplete will only fire on the first load. A...

jqTouch with ASP.NET Webforms

The form tag that wraps all ASP.NET webform applications is causing jqTouch to completely break (as in, nothing works - none of the transitions, effects, etc). Has anyone gotten jqTouch to work with a ASP.NET webforms application? ...

Unhide ASP Textbox control in Javascript Function

I have the following control: <asp:TextBox ID="textbox1" runat="server" Width="95px" MaxLength="6" /> which i would like to be hidden/invisible on page load, and have the textbox appear after clicking a button/running some javascript without reloading the page. Here's my current button: <asp:Button ID="cmdShowBox" runat="server" Tex...

how to pass value from asp.net server control using jQuery?

I UPDATED the code with code behind. I'm doing something dynamic with the label contrtol. I have the following jQuery code working as it is (passing the value of 'test") but what I want to do is to pass the value of the label control (lblNames). I'm using the label control to collect the uploaded file names. Is there a way? jQuery: $(...

ASP.NET Ajax CalendarExtender will not update SelectedDate value

For some reason, any CalendarExtenders on an ASP.NET site that is being worked on will not be updated. I have already checked all the obvious places (such as AutoPostBack and AutoEventHandler). The problem is that when I select a date from the Calendar and post it to the form, the TextBox that is being extended IS being updated, but the ...

ASP.net Authenticate with URL params in addition to Membership Provider

My current ASP.net 3.5 site uses a Membership Provider to manage authentication for the entire site defined in the web.config. I want to provide an additional method to authenticate by passing user params in the URL ex. http://site.com?user=foo&amp;pass=bar What is the best method to achieve this, also this must be able to be invoked ...

SMTP Authentication with config file's MailSettings

I'm storing my MailSettings in a web.config, however when I send the message, my SMTP server reports back that I need to use authentication. I've got my username/password in the config file, but it still fails. It works if I do the following, but it seems like an extra step. Shouldn't it just take it from the config file and use authent...

Mark-up Button Event Not Firing in ASP.NET (Details inside)

There is nothing fancy with the mark-up: <hr /> Add... <asp:Button ID="buttonTextSegment" runat="server" Text="Text Segment" onclick="buttonTextSegment_Click" /> <hr /> Or the code: protected void buttonTextSegment_Click(object sender, EventArgs e) { //never is triggered } My guess is that it is due to the hierarchy/load or...

Testing for null, inline, on an ASP.net Bind() call

I've got a bit of code that I started to manage, and it's begun to fail due to some data missing in the database. This case could happen in the future, so I'd like to gracefully handle the nulls in the front end. Here's the current code: <asp:DropDownList ID="ddlContact" runat="server" SelectedIndex='<%# Bind("contactInfo") == null ...

Get timezone difference between client and server

If my user is in California and they have their computer set to PST, it's 1:00 pm there. If my server is set to EST, the current server time is 4:00 pm. I need a way to get the timezone difference between the client and the server, either in Javascript or C#. In my example, I would get 3 (or -3, doesn't matter). Does anyone know how to...

How Make A Text File In Memory And Write Something On It And Open NotePad In Client And Open That File In It?

Hi My Dear Friends : How can i Make A Text File In Memory(Ram -> Save NoWhere) And Write Something On It And Open NotePad on top of Client browser And Open That Text File In It And Let the user save it by him/her self? -> in code behind thanks in future advance best regards ...

asp.net copying row from one datatable to another

i have a datable and like this i have searched a datarow from the datable on the basis of some primary now i want to add that searched row to another datatable how can i achieve this please let me know DataTable findRows = (DataTable)ViewState["dt"]; List<int> selectedList=(List<int>)ViewState["selectedList"]; DataTable temp = new Da...

Web deploy and folder permissions

Hi I'm using VS 2010 to build the deployment package for a web application. I manually deploy it to the IIS 6.0 server using the deployment ccommand script it generates. All the stuff gets copied under the Inetpub default website properly. The only issue I have is that the folder permissions keep getting reset once I deploy. Say my web...