FileSystemWatcher Fires Several Times?

Feb 5, 2010

I have a program which listerns to a specific directory and do some stuff once file is created on that directory. The thing is this works perfectly fine when I run it manually for testing. Meaning that when I copy and paste files in to that directory it work just fine.

Then I test it against our business system and had this problem. When our business system generates a file in that directory event fires 2-3 times and this leads to lof of problems.

Here is my code

[Code]....

View 1 Replies


Similar Messages:

PostAuthenticateRequest Fires Several Times?

Jul 7, 2010

I have Forms authentication and I need a custom object to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal.

To get this, I listen to PostAuthenticateRequest event, then read from the DB all the user data I need to be stored in HttpContext.Current.User and in Thread.CurrentPrincipal, then I instantiate custom IPrincipal and IIdentity objects and assign them to the above locations.

The problem is that for some reason PostAuthenticateRequest fires several times for a single request.. This causes unnecessary DB roundtrips that hurt performance..

How should I address this? (ASP.NET MVC 2)

View 2 Replies

C# - OnCheckedChanged Event Fires More And More Times For Every Time It Is Clicked?

Aug 31, 2010

I have an ASP.NET page that contains a gridview.

I have to create columns dynamically based on a datatable, some field type info and some header texts.

I do that by creating templates.

It created the grid fine and all looks good, however when i click a checkbox and the checkedchanged event fires then something odd happens

The first time i click its fine and i get the expected values in the event

But the second time then the event gets fired with the values from the first time and then again with the values from the checkbox that i actually clicked.. The third time the event gets fired 3 times, first 2 times with the old values and the third with the correct value.

Here is the code:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;........

View 3 Replies

Web Forms :: Page_load Event Fires Two Times In Mozilla?

Oct 19, 2010

Page_load event fires two time in firefox and the same page is working fine in IE. What might be the problem? If it is problem with Autoeventwireup then page_load event must fire two times in IE too. I believe it is not a issue of Autoeventwireup.

how can i find out exactly where the issue is.

View 2 Replies

Web Forms :: On-Click Event Fires First Time But Not Subsequent Times?

Aug 2, 2010

I have a LinkButton which fires an OnClick event to update some Labels; however, after the first firing of OnClick, it won't fire again when I click another (or the same) LinkButton which runs the same OnClick event. (It's a list of people, each a LinkButton, and clicking on one brings up their details)

If I leave the page a few minutes, it will work again, almost as if whatever was preventing OnClick firing timed-out. Of course, this won't be any use to the users!

This is my ASP.NET code for the LinkButtons (encapsulated in a DataList):

[Code]....

All the connections work, the data is retrieved, etc, so everything except the OnClick firing works. I've done a search of the internet and the forum, and found this seems to have been a long-standing problem since the first ASP.NET, but there is no solution for ASP.NET 3.5. Does anyone know what causes this, or where I might be going wrong?

View 12 Replies

MVC Application Fires Session_Start Multiple Times For A Single Session

Jul 29, 2010

We have an MVC.NET application that encounters fatal errors when it restarts. In our Session_Start event handler, we add the session id to a dictionary. In the Session_End handler, we remove it. Consider the following sequence of requests:

GET home.mvc
<application restarts>
GET main.css
GET banner.jpg
GET somedata.mvc
...

Because of the way the application is architected, this sort of sequence happens fairly frequently if you do a rebuild while the application is open in a browser window. That wouldn't be terribly concerning except that I see it in production environments too. For example, it will occur (albeit rarely) when you edit web.config.

The requests following the restart are all due to links in the home page or AJAX calls from JavaScript.

What I observe is that .NET handles the first 5 requests in parallel. Each such request causes it to fire the Session_Start event. After a short time, it fires the Session_End event 3 times. To be clear, each Session_Start corresponds to the exact same session. They all have the same session id and the IsNewSession property is true for all session state objects. Also, the Session_End events do not correspond to the session being killed. The session persists, along with any data stored in session state.

I need to either prevent it from firing Session_Start more than once or figure out how to tell when Session_End doesn't really mean that the session has ended.

View 2 Replies

Forms Data Controls :: DetailsView DataBound Fires Multiple Times?

Jun 14, 2010

Here is my code:

[Code]....

The problem is that BindHeaders is called multiple times. I was expecting it to fire only once since a very similar code I used to customize the GridView control to use our mapping utility on the headers works this way.

View 5 Replies

Web Development - SelectedIndexChanged For Programmatically Created Dropdownlist In ASP.NET Fires Multiple Times.

Mar 12, 2010

Consider the following:The SomeEvent fires as expected when any of the dropdown's selection is changed. However if say DropdownList2 has a selection made then I make a selection with either DropDownList1 or DropdownList3, then SomeEvent fires again. What is causing this behavior and how do I get just a single raising of that event?I suspect that when the viewstate for the dynamcially created dropdownlists is restored and the selection restored, then the event is fired because technically the selected index did change when the control was recreated. The reason I suspect this is that the event fires the for each dropdownlist.

View 3 Replies

Forms Data Controls :: On Dynamic Control The DropDownList SelectedIndexChanged Event Fires Several Times?

Aug 4, 2010

I ask for a date, on OnTextChanged event i bind data with a SqlDataSource to a dropdownlist and also bind data to a repeater passing the dropdownlist SelectedIndex (i use SqlDataSource too and ControlParameter to link the dropdownlist and the repeater) On my repeater during the ItemDataBound event i create dynamic dropdownlist controls, my code is :

[Code]....

[Code]....

On the Page_load event of my page i bind the data & recreate the control :

[Code]....

Everything works fine, datas are bound and SelectedIndexes are restore on every postback.

The probem occurs when user change different dropdownlists, if he choose to change the 1st dropdownlist the event is fire (normal), after if he modifies another dropdownlist the event is fire twice, if he modifies a 3rd time the event is fire 3 time etc...

View 18 Replies

Response.Redirect On FileSystemWatcher Event?

Sep 9, 2010

I don't manage to use a Response.Redirect (or Response.Write) on a new FileSystemWatcher event.

protected void Page_Load(object sender, EventArgs e)
{
RunFolderListener();
}

[code]...

View 3 Replies

C# - Monitoring A Folder For New File Creation Without Using FileSystemWatcher In .net?

Aug 31, 2010

I have to create a windows service which Monitors a specified folder for new files and does someprocessing on it and moves it to other location. I started with using FileSystem Watcher. But my boss doesn't like FileSystemWatcher and wants me to use polling on Timer or any other mechanism other than File System Watcher. I am confused right now. It would be great if anyone could point me to some examples for how to monitor Folders without using File System Watcher in .net environment.

View 8 Replies

HttpHandlers / Modules :: Automating An Http Handler / Filesystemwatcher To Post An Xml Document To Another Server (with No Human Interaction)?

Jul 20, 2010

This is kind of cross-post; however, can a custom http handler be automated to run either using a timer or a filesystemwatcher to post an xml document to another server (with no human interaction)?

View 2 Replies

How To Remove The Row When Hit Button Fires Up

Nov 23, 2010

i want to do with the grid. first is how can i remove the row whenever the hit button fires up. Note that it will only remove the row in the grid and not deleting the entry. Second, when the Update button fires up I need to update all rows in the grid and set value of Status column to the row dropdownlist value.I'm thinking of adding another button inline with the row instead of doing a batch update. Would you think it would be convenient design in terms of net traffic?

View 8 Replies

ASHX Handler; Fires Up Only Once?

Jun 23, 2010

I've got a simple ASHX handler that returns an dynamically generated image; the image is generated from a custom created class, and an object belonging to this class is passed to the handler using Session (I'd rather avoid using QueryString).The handler is used as the URL of an image on a ASP form which is very simple: a drop down list, a button and an image. Basically, depending on what the user selects from the list, the appropriate image will be generated once the button is pressed.

At the start the actual image has it's Visible property set to false; I don't want the handler to display anything before the data is all there.Once the button is pressed, the required Session parameter is added containing the necessary object, and the page is refreshed using Server.Transfer. When the Page_load method detects that the Session parameter has been correctly set, it sets the Visible parameter on the image to true.After that the handler fires up and generates the image.

So far so good... However, if the user now picks something different from the list and presses the button, despite the correct object being passed in the Session, the image won't be updated. In fact, the handler won't even fire up (if I put a breakpoint in there). I need to close the browser window and reopen it for it to work.Any ideas what could be the cause of such behaviour?I suspect the answer is very simple, and I just don't know something fundamental about ASP (or handlers)...

View 1 Replies

Web Forms :: RegularExpressionValidator Always Fires?

Feb 15, 2010

I am using a RegularExpressionValidator in my code as follows:

<asp:RegularExpressionValidator ID="rev1" runat="server"
ValidationExpression="[a-zA-Z0-9]{5,7}"
ControlToValidate="txtTAM5" ErrorMessage="Please enter a valid value." SetFocusOnError="True"
Display="Dynamic" ValidationGroup="vg1"></asp:RegularExpressionValidator>

View 4 Replies

AJAX :: ValidatorCalloutExtender Fires On The Second Try?

Nov 19, 2010

I have a comparevalidator which is used for a textbox. This comparevalidator supposed to work when user clicks submit button. But it fires on the second try. Here is the code.

[Code]....

Here is the vb portion

[Code]........

The problem is validatorcalloutextender fires when i click this Button_OK twice.

View 3 Replies

C# - SessionState Timeout Never Fires?

Nov 26, 2010

What am I doing wrong. The sessionState Timeout never fires,It only fires after 24 hours, I want to let it fire in 20 minutes on my webpage. In the web.config I handle the sessionstate like this:

<sessionState cookieless="false" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
timeout="1" stateNetworkTimeout="1"/>

timeout="1" is on purpose, for testing.And in the code I check on which session I am by calling Session.SessionID.ToString()

View 3 Replies

Ajax - Jquery Event Fires Twice

Feb 10, 2010

I've got the an bit of ajax and the succeed runs twice. I've got a global var that I used to keep track.

Code:
var counter = 0
$('#txtLookupText').keyup(function(event) {
$(document).ready(function() {
});
$.ajax({
type: "POST",
url: 'ContactLookup.aspx/LookupContacts',
data: "{'inputStr': '" + $('#txtLookupText').val() + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
function AjaxSucceeded(result) {
if (result.hasOwnProperty("d")) { result = result.d; }
var li = ''
for (i = 0; i < result.length; i++) {
li += result[i].FirstName + ' ' + result[i].LastName + '
}
counter += 1
alert(counter)
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}

I moved the counter to the POST and only got one alert box. In the succeed, I get 2 alert boxes in succession.

View 5 Replies

Web Forms :: RadioButton CheckedChanged Fires Twice

Aug 5, 2010

I have one RadionButton and a Button.

When I clik on RadionButton it fires it CheckedChanged Function perfectly.

But, when I click on the Button, it ALSO fires the same RadionButton ChechedChanged Function! I don't know why!!!

I want to avoid that! I don't want the button firing that RadioButton function.

View 6 Replies

JQuery :: BlockUI Fires Before Validation?

May 19, 2010

Trying to use BlockUI and asp.net validation groups on a page but the validators are not fired.How to check which control fired the event and fire the validation group of that event inside jquery ?Here is the script file.

Sys.Application.add_init(function() {
// Allows the div.blockMsg style in CSS to
// override BlockUI's defaults.
$.blockUI.defaults.css = {}; [code].....

View 2 Replies

AJAX AsyncFileUpload UploadedComplete Not Fires

Sep 17, 2010

I'm new to ASP.NET AJAX AsyncFileUpload so I've created an aspx page to test it but it seems there's some bug with that control because the server side UploadedComplete event does not fire.

the aspx :

<form id="form1" runat="server" method="post" enctype="multipart/form-data">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> [code]....

View 3 Replies

Page Load Fires Twice On Firefox ?

Jan 28, 2010

I have a page showing the number of hits(or views) of any selected item. The hit counter procedure that is called at every page load i.e

if (Request.QueryString.HasKeys())
{
// get item id from icoming url e.g details.aspx?itemid=26
string itemid = Request.Params["itemid"];
[code]...

View 6 Replies

Web Forms :: MasterPage Onload Fires Twice?

Jan 20, 2011

I have abit of a problem, with the AutoEventWireup setting.

Currently, my master page's onload seems to fire twice. If i set wireup to false, it doesn't fire at all.

All my page, using the masterpage, also has the setting set to true.

Should i only have it set to true in the master?

What happens to my events in the indidual pages then? Does the masterpage handle the wireup, if they are set to false, and it is set to true?

View 3 Replies

C# - Field Validator Fires Undesirably?

Jan 19, 2011

I have a page with the following mark up

<%@ Page Title="" Language="C#" MasterPageFile="~/CaseAdmin.master" AutoEventWireup="true" CodeBehind="AddExhibit.aspx.cs" Inherits="Prototype5.AddExhibit" %>
<h2 class="style2">

[Code]....

and the following interface look

I wish to perform validation on the page only when the "add exhibit button" is clicked. so in my code behind, i used an "if(page.isvalid)" to check for page validation when the button is clicked. However any other button i click fires the validation as well... I presume its because every button click tries to load a page and that calls the validator to action. how do i allow work around the validation such that, only the " add exhibit button" triggers the page validation?

View 1 Replies

Page_PreRender Fires Twice On First Load In Session?

Apr 29, 2010

When I run the web application, I notice that Page_PreRender is fired twice. This only happens the first time in a new session. It does not happen if I refresh the page, or on postbacks. I use .NET framework 3.5 and the built in ajax functionality.

The problem is not related to img tag with empty src attribute (which I have seen other posts with similar problem has mentioned). I know this because I see this in both FireFox and IE. The posts I saw about this stated that this was not a problem in IE. I have also searched and found no img tags with empty src in the generated page source, so it should not be this. I have also made a simple test page where I have included some of the functionality, and this does not happen.

Note: It is the entire page cycle that is firing twice, not just render.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved