ASP.NET Application and FileSystemWatcher

J

J-T

We are working on an asp.net application which is a 3-tier application.I was
aksed to create a component which monitors a folder and gets the file and
pass them to a class library in our business logic layer(so far so good and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher class
not very reliable and sometimes it behavies unexpectedly.I'm afriad that it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
K

Kevin Spencer

Hi J-T,
I have found FileSystemWatcher class not very reliable and sometimes it
behavies unexpectedly.I'm afriad that it brings down the whole
application.

The FileSystemWatcher class is very reliable. However, it uses events, which
are asynchronous to your application. Without knowing anything more about
how your code is written, I can't tell you much more. For example,
"Global.asax" is a file. The Global class that is generated when it is
compiled is a class. It contains a number of events, and you can't store a
class in an event. So, I have no idea where you're persisting your class, or
how. Also, you mentioned that you created a "component," which most probably
is not a "Component" in the literal .Net sense of the term. So, I know
nothing about that either.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.
 
E

Eliyahu Goldin

Are you sure you are on the right track? A FileSystemWatcher object has to
exist somewhere to be able to watch. An asp.net application doesn't exist
anywhere but between a client http request and the server response. A very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu
 
J

J-T

Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}
 
J

J-T

I forgot to say that directory which I monitor is a shared folder on the
netwrok.

Thanks
 
E

Eliyahu Goldin

This could be a problem. In my experience I could not get FileSystemWatcher
to work for network directories. Either it is not able to or some tricky
setting is needed.

Eliyahu
 
K

Kevin Spencer

Your FileSystemWatcher is scoped to the method in which you instantiate it.
That means that it goes out of scope and is not available as soon as the
method returns. It may hang around for a bit since you have no code to
dispose it at any point, but you need to bone up on scope and state. Here's
a primer:

Scope is the "area of influence" of a variable. In a class, you have global
and local variables. Global variables are declared outside of any methods,
and are therefore "visible" to all members of the class. Local variables are
declared inside a method, and are therefore "visible" only to other
variables within a single instance (call) of the method. Once the method
returns, it is removed from the stack, and everything in it becomes
available for garbage collection.

Note that this differs from public, private, etc. These are also definitions
of scope, but are more related to encapsulation. Public members of a class
are "visible" from other classes. Private members are not. Etc.

State refers to the persistence of an object (class instance or primitive)
in memory. Whenever an object is instantiated (created), it must reside in
memory somewhere. The lifetime of an object is limited to the lifetime of
the container in which it resides. A method is instantiated, just like a
variable, whenever you call it. And just like a variable, when it returns,
it is available for garbage collection. The only way to persist an instance
is to put it into something else that persists. Hence, ASP.Net, which
operates using HTTP, which is stateless, has mechanisms for maintaining
state, such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a persistent
class, but it's methods are not. They are instantiated like any other
methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works as
you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Eliyahu Goldin said:
Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu
 
J

J-T

So how would you monitor a network path in your asp.net application?
Thanks for your reply.
 
J

J-T

So you mean state wise and persistence wise,both,I will have problems by
using this code?

Do you have any idea how to persist my object.I want it to avaialable as
long as they application is up and working.So according to what you suggest
I will have to make the scope of my object some how global (not like the way
it is now) and also persist it in the memory for the time application is up.
Do I really have to dispose the object after the application gets stopped?

Thanks for super informative answer.

Ray
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code to
dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once the
method returns, it is removed from the stack, and everything in it becomes
available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or primitive)
in memory. Whenever an object is instantiated (created), it must reside in
memory somewhere. The lifetime of an object is limited to the lifetime of
the container in which it resides. A method is instantiated, just like a
variable, whenever you call it. And just like a variable, when it returns,
it is available for garbage collection. The only way to persist an
instance is to put it into something else that persists. Hence, ASP.Net,
which operates using HTTP, which is stateless, has mechanisms for
maintaining state, such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a persistent
class, but it's methods are not. They are instantiated like any other
methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works
as you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Eliyahu Goldin said:
Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
J

J-T

I forgot to say that if I keep my object in an application variable,then the
persistence problem will be solved,right?

Thanks
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code to
dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once the
method returns, it is removed from the stack, and everything in it becomes
available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or primitive)
in memory. Whenever an object is instantiated (created), it must reside in
memory somewhere. The lifetime of an object is limited to the lifetime of
the container in which it resides. A method is instantiated, just like a
variable, whenever you call it. And just like a variable, when it returns,
it is available for garbage collection. The only way to persist an
instance is to put it into something else that persists. Hence, ASP.Net,
which operates using HTTP, which is stateless, has mechanisms for
maintaining state, such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a persistent
class, but it's methods are not. They are instantiated like any other
methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works
as you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Eliyahu Goldin said:
Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
E

Eliyahu Goldin

Even if you persist an object in the application, how can you make sure the
application is running? Did you consider windows service?

Eliyahu

J-T said:
So you mean state wise and persistence wise,both,I will have problems by
using this code?

Do you have any idea how to persist my object.I want it to avaialable as
long as they application is up and working.So according to what you suggest
I will have to make the scope of my object some how global (not like the way
it is now) and also persist it in the memory for the time application is up.
Do I really have to dispose the object after the application gets stopped?

Thanks for super informative answer.

Ray
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code to
dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once the
method returns, it is removed from the stack, and everything in it becomes
available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or primitive)
in memory. Whenever an object is instantiated (created), it must reside in
memory somewhere. The lifetime of an object is limited to the lifetime of
the container in which it resides. A method is instantiated, just like a
variable, whenever you call it. And just like a variable, when it returns,
it is available for garbage collection. The only way to persist an
instance is to put it into something else that persists. Hence, ASP.Net,
which operates using HTTP, which is stateless, has mechanisms for
maintaining state, such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a persistent
class, but it's methods are not. They are instantiated like any other
methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works
as you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
E

Eliyahu Goldin

You can set up a scheduled task that will copy files over to a local
directory periodically. Not very elegant, but works.

Eliyahu
 
K

Kevin Spencer

I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running when it
is idle (no requests) for a period of more than (by default) 20 minutes.
When the application is stopped, the FileSystemWatcher will be stopped. When
the application restarts, the FileSystemWatcher will be restarted as well.
HOWEVER, any changes to the file system that the Watcher is supposed to
watch during the idle interval will go unnoticed. Now, as long as changes to
the files in the folder are also done by the ASP.Net app, there will BE no
changes while the app is stopped. So, while I can't answer your question
directly, this information, plus what you already know, should give you the
solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code
to dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once
the method returns, it is removed from the stack, and everything in it
becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited to
the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just like a
variable, when it returns, it is available for garbage collection. The
only way to persist an instance is to put it into something else that
persists. Hence, ASP.Net, which operates using HTTP, which is stateless,
has mechanisms for maintaining state, such as Session, Application, and
ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works
as you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
R

Ray5531

How about this :

Make my object remotly callable and register an sponser in the same
machine(Webserver) to call my object when it is going to be leased?

Makes sense?

Thanks for your help.

Kevin Spencer said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running when
it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go unnoticed.
Now, as long as changes to the files in the folder are also done by the
ASP.Net app, there will BE no changes while the app is stopped. So, while
I can't answer your question directly, this information, plus what you
already know, should give you the solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code
to dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once
the method returns, it is removed from the stack, and everything in it
becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited to
the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just like
a variable, when it returns, it is available for garbage collection. The
only way to persist an instance is to put it into something else that
persists. Hence, ASP.Net, which operates using HTTP, which is stateless,
has mechanisms for maintaining state, such as Session, Application, and
ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to persist
your FileSystemWatcher, as well as making sure that when you are
finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
R

Ray5531

The reason I'm bearing with all these problems is that I don;t want to use a
seperate component outside of our asp.net application.What do you mean by
using a windows service? you mean using windows service to keep the object
alive ? kind of sponser thing in remoting?

Thanks
Eliyahu Goldin said:
Even if you persist an object in the application, how can you make sure
the
application is running? Did you consider windows service?

Eliyahu

J-T said:
So you mean state wise and persistence wise,both,I will have problems by
using this code?

Do you have any idea how to persist my object.I want it to avaialable as
long as they application is up and working.So according to what you suggest
I will have to make the scope of my object some how global (not like the way
it is now) and also persist it in the memory for the time application is up.
Do I really have to dispose the object after the application gets
stopped?

Thanks for super informative answer.

Ray
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon
as
the method returns. It may hang around for a bit since you have no code to
dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of
any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible"
only
to other variables within a single instance (call) of the method. Once the
method returns, it is removed from the stack, and everything in it becomes
available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members
are
not. Etc.

State refers to the persistence of an object (class instance or primitive)
in memory. Whenever an object is instantiated (created), it must reside in
memory somewhere. The lifetime of an object is limited to the lifetime of
the container in which it resides. A method is instantiated, just like
a
variable, whenever you call it. And just like a variable, when it returns,
it is available for garbage collection. The only way to persist an
instance is to put it into something else that persists. Hence,
ASP.Net,
which operates using HTTP, which is stateless, has mechanisms for
maintaining state, such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a persistent
class, but it's methods are not. They are instantiated like any other
methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP works
as you go. In the meantime, you need to understand how to persist your
FileSystemWatcher, as well as making sure that when you are finished with
it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate
that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[
"MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path
to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object has
to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when
the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the
file
and
pass them to a class library in our business logic layer(so far so good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found
FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing
this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
K

Kevin Spencer

You can't remotely call an object. An object is a type, just like an
Integer, or a Function. It exists only as an instance inside an application.
So, you have to write a service if you want it to run all the time. You
COULD keep your ASP.Net Application alive by making Requests to the app
shortly before the Application Timeout, but that would require a client
application to be running all the time.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Ray5531 said:
How about this :

Make my object remotly callable and register an sponser in the same
machine(Webserver) to call my object when it is going to be leased?

Makes sense?

Thanks for your help.

Kevin Spencer said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running when
it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go unnoticed.
Now, as long as changes to the files in the folder are also done by the
ASP.Net app, there will BE no changes while the app is stopped. So, while
I can't answer your question directly, this information, plus what you
already know, should give you the solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon
as the method returns. It may hang around for a bit since you have no
code to dispose it at any point, but you need to bone up on scope and
state. Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of
any methods, and are therefore "visible" to all members of the class.
Local variables are declared inside a method, and are therefore
"visible" only to other variables within a single instance (call) of
the method. Once the method returns, it is removed from the stack, and
everything in it becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members
are not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited
to the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just like
a variable, when it returns, it is available for garbage collection.
The only way to persist an instance is to put it into something else
that persists. Hence, ASP.Net, which operates using HTTP, which is
stateless, has mechanisms for maintaining state, such as Session,
Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to persist
your FileSystemWatcher, as well as making sure that when you are
finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate
that class in Application_Start method of my Global.asax ere is the
code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[
"MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path
to monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when
the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the
file and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found
FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing
this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
R

Ray5531

Or how about this:

OnCreate event of the file ,I query the directory for all the files of the
type of I want and loop through them and enforce what I want.In the way even
if the application is in idle mode and filesystemWatcher is down as well,the
next file which triggers the fileSystemWatcher causes all the other files to
be processed as well.

Thanks
Kevin Spencer said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running when
it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go unnoticed.
Now, as long as changes to the files in the folder are also done by the
ASP.Net app, there will BE no changes while the app is stopped. So, while
I can't answer your question directly, this information, plus what you
already know, should give you the solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Kevin Spencer said:
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon as
the method returns. It may hang around for a bit since you have no code
to dispose it at any point, but you need to bone up on scope and state.
Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of any
methods, and are therefore "visible" to all members of the class. Local
variables are declared inside a method, and are therefore "visible" only
to other variables within a single instance (call) of the method. Once
the method returns, it is removed from the stack, and everything in it
becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members are
not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited to
the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just like
a variable, when it returns, it is available for garbage collection. The
only way to persist an instance is to put it into something else that
persists. Hence, ASP.Net, which operates using HTTP, which is stateless,
has mechanisms for maintaining state, such as Session, Application, and
ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to persist
your FileSystemWatcher, as well as making sure that when you are
finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate that
class in Application_Start method of my Global.asax ere is the code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[ "MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path to
monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the file
and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
K

Kevin Spencer

Or how about this:
OnCreate event of the file ,I query the directory for all the files of the
type of I want and loop through them and enforce what I want.In the way
even if the application is in idle mode and filesystemWatcher is down as
well,the next file which triggers the fileSystemWatcher causes all the
other files to be processed as well.

If you're going to do that, you don't need anything right away, right? In
that case, you don't need a FileSystemWatcher at all, just a timer and
System.IO to check and keep track of the contents of the folder. Problem
solved, at least if you don't need the data immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Ray5531 said:
Or how about this:

OnCreate event of the file ,I query the directory for all the files of the
type of I want and loop through them and enforce what I want.In the way
even if the application is in idle mode and filesystemWatcher is down as
well,the next file which triggers the fileSystemWatcher causes all the
other files to be processed as well.

Thanks
Kevin Spencer said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running when
it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go unnoticed.
Now, as long as changes to the files in the folder are also done by the
ASP.Net app, there will BE no changes while the app is stopped. So, while
I can't answer your question directly, this information, plus what you
already know, should give you the solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Your FileSystemWatcher is scoped to the method in which you instantiate
it. That means that it goes out of scope and is not available as soon
as the method returns. It may hang around for a bit since you have no
code to dispose it at any point, but you need to bone up on scope and
state. Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of
any methods, and are therefore "visible" to all members of the class.
Local variables are declared inside a method, and are therefore
"visible" only to other variables within a single instance (call) of
the method. Once the method returns, it is removed from the stack, and
everything in it becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members
are not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited
to the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just like
a variable, when it returns, it is available for garbage collection.
The only way to persist an instance is to put it into something else
that persists. Hence, ASP.Net, which operates using HTTP, which is
stateless, has mechanisms for maintaining state, such as Session,
Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to persist
your FileSystemWatcher, as well as making sure that when you are
finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate
that class in Application_Start method of my Global.asax ere is the
code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[
"MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path
to monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response. A
very
short time. Do you expect the watcher to catch something only when
the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the
file and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in my
Global.asax and everything works fine.I have found
FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing
this
**Inside Asp.Net application**.I can't use antother application like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
J

J-T

I don't need the data immidiately at all.I need to get them sometimes
anyway.you mean I should implement a timer in my class which makes my object to be
executed at a time interval for changes in an specific folder?

Thanks
Kevin Spencer said:
Or how about this:

OnCreate event of the file ,I query the directory for all the files of
the type of I want and loop through them and enforce what I want.In the
way even if the application is in idle mode and filesystemWatcher is down
as well,the next file which triggers the fileSystemWatcher causes all the
other files to be processed as well.

If you're going to do that, you don't need anything right away, right? In
that case, you don't need a FileSystemWatcher at all, just a timer and
System.IO to check and keep track of the contents of the folder. Problem
solved, at least if you don't need the data immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Ray5531 said:
Or how about this:

OnCreate event of the file ,I query the directory for all the files of
the type of I want and loop through them and enforce what I want.In the
way even if the application is in idle mode and filesystemWatcher is down
as well,the next file which triggers the fileSystemWatcher causes all the
other files to be processed as well.

Thanks
Kevin Spencer said:
I forgot to say that if I keep my object in an application
variable,then the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running
when it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go unnoticed.
Now, as long as changes to the files in the folder are also done by the
ASP.Net app, there will BE no changes while the app is stopped. So,
while I can't answer your question directly, this information, plus what
you already know, should give you the solution you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

I forgot to say that if I keep my object in an application variable,then
the persistence problem will be solved,right?

Thanks
Your FileSystemWatcher is scoped to the method in which you
instantiate it. That means that it goes out of scope and is not
available as soon as the method returns. It may hang around for a bit
since you have no code to dispose it at any point, but you need to
bone up on scope and state. Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of
any methods, and are therefore "visible" to all members of the class.
Local variables are declared inside a method, and are therefore
"visible" only to other variables within a single instance (call) of
the method. Once the method returns, it is removed from the stack, and
everything in it becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members
are not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created), it
must reside in memory somewhere. The lifetime of an object is limited
to the lifetime of the container in which it resides. A method is
instantiated, just like a variable, whenever you call it. And just
like a variable, when it returns, it is available for garbage
collection. The only way to persist an instance is to put it into
something else that persists. Hence, ASP.Net, which operates using
HTTP, which is stateless, has mechanisms for maintaining state, such
as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated like
any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to
persist your FileSystemWatcher, as well as making sure that when you
are finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate
that class in Application_Start method of my Global.asax ere is the
code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[
"MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path
to monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int) oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response.
A very
short time. Do you expect the watcher to catch something only when
the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the
file and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in
my
Global.asax and everything works fine.I have found
FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm afriad
that
it
brings down the whole application.Is there a better way of doing
this
**Inside Asp.Net application**.I can't use antother application
like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 
K

Kevin Spencer

I mean that you should create a timer in your Application_OnStart event
handler, store it in the Application Cache, and let its Elapsed event
handler do the work. If your Application stops, the timer stops. But when
the Application starts, the timer restarts.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

J-T said:
I don't need the data immidiately at all.I need to get them sometimes
anyway.you mean I should implement a timer in my class which makes my object to
be executed at a time interval for changes in an specific folder?

Thanks
Kevin Spencer said:
Or how about this:

OnCreate event of the file ,I query the directory for all the files of
the type of I want and loop through them and enforce what I want.In the
way even if the application is in idle mode and filesystemWatcher is
down as well,the next file which triggers the fileSystemWatcher causes
all the other files to be processed as well.

If you're going to do that, you don't need anything right away, right? In
that case, you don't need a FileSystemWatcher at all, just a timer and
System.IO to check and keep track of the contents of the folder. Problem
solved, at least if you don't need the data immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Ray5531 said:
Or how about this:

OnCreate event of the file ,I query the directory for all the files of
the type of I want and loop through them and enforce what I want.In the
way even if the application is in idle mode and filesystemWatcher is
down as well,the next file which triggers the fileSystemWatcher causes
all the other files to be processed as well.

Thanks
I forgot to say that if I keep my object in an application
variable,then the persistence problem will be solved,right?

Yes. However, be aware that an ASP.Net application will stop running
when it is idle (no requests) for a period of more than (by default) 20
minutes. When the application is stopped, the FileSystemWatcher will be
stopped. When the application restarts, the FileSystemWatcher will be
restarted as well. HOWEVER, any changes to the file system that the
Watcher is supposed to watch during the idle interval will go
unnoticed. Now, as long as changes to the files in the folder are also
done by the ASP.Net app, there will BE no changes while the app is
stopped. So, while I can't answer your question directly, this
information, plus what you already know, should give you the solution
you need.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

I forgot to say that if I keep my object in an application
variable,then the persistence problem will be solved,right?

Thanks
Your FileSystemWatcher is scoped to the method in which you
instantiate it. That means that it goes out of scope and is not
available as soon as the method returns. It may hang around for a bit
since you have no code to dispose it at any point, but you need to
bone up on scope and state. Here's a primer:

Scope is the "area of influence" of a variable. In a class, you have
global and local variables. Global variables are declared outside of
any methods, and are therefore "visible" to all members of the class.
Local variables are declared inside a method, and are therefore
"visible" only to other variables within a single instance (call) of
the method. Once the method returns, it is removed from the stack,
and everything in it becomes available for garbage collection.

Note that this differs from public, private, etc. These are also
definitions of scope, but are more related to encapsulation. Public
members of a class are "visible" from other classes. Private members
are not. Etc.

State refers to the persistence of an object (class instance or
primitive) in memory. Whenever an object is instantiated (created),
it must reside in memory somewhere. The lifetime of an object is
limited to the lifetime of the container in which it resides. A
method is instantiated, just like a variable, whenever you call it.
And just like a variable, when it returns, it is available for
garbage collection. The only way to persist an instance is to put it
into something else that persists. Hence, ASP.Net, which operates
using HTTP, which is stateless, has mechanisms for maintaining state,
such as Session, Application, and ViewState.

The global.asax class, as I mentioned in my earlier reply, is a
persistent class, but it's methods are not. They are instantiated
like any other methods, and pass out of scope as soon as they return.

I hope you will study what I've said, and continue to study how OOP
works as you go. In the meantime, you need to understand how to
persist your FileSystemWatcher, as well as making sure that when you
are finished with it, you dispose it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

Here is what I have done .I have created a class and I instanciate
that class in Application_Start method of my Global.asax ere is the
code:

********Gloabl.asax:
//Sets up a wacher on an specific shared folder to pickup zip files

IFPWatcherComponent ifpWacher=new
IFPWatcherComponent(ConfigurationSettings.AppSettings[
"MonitorPath"]);



********MyClass:

/// </summary>
public class IFPWatcherComponent:BusinessObject
{
string PathToMonitor=null;

public IFPWatcherComponent(string PathToMonitor)
{

try
{
this.PathToMonitor = PathToMonitor;
//Check to see if Web.config has appropriate settings
if (this.PathToMonitor.Trim().Length==0 ) return;
// Make a reference to a directory.
DirectoryInfo di = new DirectoryInfo(this.PathToMonitor);
// Create the directory only if it does not already exist.
if (di.Exists == false)
di.Create();
// create an instance of FileSystemWatcher object and assign path
to monitor
FileSystemWatcher watcher = new FileSystemWatcher();
// set necessary filters
watcher.Path = this.PathToMonitor;
//Watch for changes in FileName
watcher.NotifyFilter = NotifyFilters.FileName;
// watch zip files
watcher.Filter = "*.zip";
//Add appropriate event handler
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;
}
catch
{
throw;
}
}
private void OnCreated(object source, FileSystemEventArgs e)
{
FileStream oImg=null;
BinaryReader oBinaryReader=null;

Uploader uploader=new Uploader();
uploader.ComeFrom="88";
uploader.Comments="comment";
uploader.CreatedByUser="test";
uploader.FileName=e.Name;

try
{

oImg = new FileStream (e.FullPath,FileMode.Open,FileAccess.Read);
oBinaryReader = new BinaryReader(oImg);
byte[] oImgByteArray = oBinaryReader.ReadBytes((int)
oImg.Length);
uploader.FileBody=oImgByteArray;

uploader.RecordType=Business.IFP.RecordType.IFP_UPLOAD;
uploader.Upload();
uploader=null;

}
catch(Exception ee)
{
*******************I don't know how to handle the exception
here??***********************
}
finally
{
if (oBinaryReader!=null) oBinaryReader.Close();
if (oImg!=null) oImg.Close();

}
}

Are you sure you are on the right track? A FileSystemWatcher object
has to
exist somewhere to be able to watch. An asp.net application doesn't
exist
anywhere but between a client http request and the server response.
A very
short time. Do you expect the watcher to catch something only when
the
server is busy serving client requests?

Eliyahu


We are working on an asp.net application which is a 3-tier
application.I
was
aksed to create a component which monitors a folder and gets the
file and
pass them to a class library in our business logic layer(so far so
good
and
easy).I initialize my class which is using a FileSystemWatcher in
my
Global.asax and everything works fine.I have found
FileSystemWatcher
class
not very reliable and sometimes it behavies unexpectedly.I'm
afriad that
it
brings down the whole application.Is there a better way of doing
this
**Inside Asp.Net application**.I can't use antother application
like
windows
service or schedault taks.Everything needs to be done is ASP.NET
application.


Thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top