|
Hello there,
I need to monitor changes made to a certain file from ASP.NET website application. I decided to accomplish this using System.IO.FileSystemWatcher. Currently I am having the following problems
1. I can't make my watcher monitor a single file not just the whole folder content.
2. Even if I try the whole-folder-monitoring scenario it turns out that the Change event fires 5 times instead of 1. Any magic behind this number?
Here's the source code inside my Global.asax file. Commented lines include adjustments I tried to enable monitoring specific file.
1 void Application_Start(object sender, EventArgs e) <br />
2 {<br />
3
4 <br />
5 <br />
6 <br />
7 System.IO.FileSystemWatcher __file_watcher = new System.IO.FileSystemWatcher();<br />
8 Application.Add("AdConfigurationWatcher",__file_watcher);<br />
9 __file_watcher.Path = Server.MapPath("~/");<br />
10 __file_watcher.IncludeSubdirectories = false;<br />
11 __file_watcher.NotifyFilter = System.IO.NotifyFilters.LastWrite;<br />
12
13 <br />
14 <br />
15 __file_watcher.Changed += new System.IO.FileSystemEventHandler(__file_watcher_Changed);<br />
16 <br />
17 __file_watcher.EnableRaisingEvents = true;<br />
18 }<br />
19 <br />
20 void __file_watcher_Changed(object sender, System.IO.FileSystemEventArgs e)<br />
21 {<br />
22
23 System.IO.WatcherChangeTypes c = e.ChangeType;<br />
24 }<br />
25 <br />
26 void Application_End(object sender, EventArgs e) <br />
27 {<br />
28
29 System.IO.FileSystemWatcher __file_watcher = Application["AdConfigurationWatcher"] as System.IO.FileSystemWatcher;<br />
30 Application.Remove("AdConfigurationWatcher");<br />
31 __file_watcher.Dispose();<br />
32 }
|
|
|
|
|
Hi All,
I m displaying my data on a datagrid. There is a field Stock Quantity, I want the record of 0 to be highlight when it take data from DB. How can I do.For example
SKU MFR_Code Stock_Quantity
KU KIJ 100
IO IKI 50
IOP SAF 0
The third record IOP should be in Red. What should I do. Pls help me. Its very urgent.
Thanks in advance.
|
|
|
|
|
You need to do this using itemdatabound event....
Lets work it Out.........!
|
|
|
|
|
Whats is this dear, there is nothing. Please read it.
|
|
|
|
|
IMO, he means that you use that event to customize the gridrow's display ...
<< >>
|
|
|
|
|
Hi Friend !!!!
pls Help me !! I have been wondering with code !
i have a table in that table there r two fields latitude and longitude with more than 50 records.
i have to retrive latitude and longitude values (First Ten Records) from database(SqlServer) through javascript in asp.net.I have a GoogleMap on my Form.
after getting this coordinates for ten records,
i have to display the position with 10 markers on the Google Map for ten records , according to their coordinates(Lat,Long).
so pls help me!!!!!!!!! to come out of this code
Thanks
Ashok Thakur
|
|
|
|
|
You might look into AJAX concept...
<< >>
|
|
|
|
|
Hi enjoycrack
Thanks for helping me.
i was wondering because of this ajax concept.
Thanks a lot!!!!!!!!!!!1
Ashok Thakur
|
|
|
|
|
Hi guys,
I am programming web.sitemap for my web application.I am using one default page on which i am retrieving the content for the menus from the database with the help of querystring.
The problem is I am unable to achieve the sitemap for my application.The <asp:SiteMapPath> control is unable to produce the navigating path.
if anybody has suggestions for this problem please reply.
Thanks
Jith
|
|
|
|
|
I am trying to do a search. When I type a character inside the textbox it should take all the feild value which starts with that character. Below code it is not showing any error, but not binding to the datagrid.
string s = "%S" + TextBox5.Text + "%";
string d = "SELECT field1, field2,... FROM OUTSTANDING WHERE field1 LIKE '"+ s +"'";
try{
OdbcCommand CMD = new OdbcCommand(d, c);
DataSet DT = new DataSet();
c.Open();
OdbcDataAdapter a = new OdbcDataAdapter(CMD);
CMD.ExecuteNonQuery();
a.Fill(DT, Tablename);
GridView1.DataSource = DT;
GridView1.DataBind();
}
|
|
|
|
|
Your code is not secure, but I assume from the variable names that this isn't code that will be used in the real world anyhow ?
A kamath wrote: string s = "%S" + TextBox5.Text + "%";
If you type in e, you will search for anything that starts with Se. Turn %S into % and it will work the way you described it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks a million. It is working hurray
|
|
|
|
|
Hi,
I want to have an editable Combobox/ Dropdownlist.
When the dropdownlist gets populated, i should be able to change the text of the items . The dropdown should now store the new edited text.
Does anyone know how to do this?
It's very urgent.
Thanks,
Riz
|
|
|
|
|
You can write javascript to add items to select boxes. IS that what you mean ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
No, i think u have not understood my query.
I want to have a dropdownlist which can be editable. i.e. i want to edit the values of the dropdownlist. Do u know how to do it?
|
|
|
|
|
Hi!
In my application ,startup page is Base.aspx. Base.aspx contains four tabs & an ifrmae. the source of iFrame changes depending upon which tab is clicked. one of tab when clicked of the Base.aspx, then source of iFrame become login.aspx. when valid user is logins, the redirected to BaseTwo.aspx which also contains tabs & a iFrame & source of this iframe changed depending upon tab clicked on BaseTwo.aspx. i want to apply From Authentication in this application. setting web.config is ....
<authentication mode="Forms">
<forms loginurl="login.aspx" path="/" protection="All">
<authorization>
<deny users="?">
now when i run application login page is loaded instead of startup page Base.aspx & also images are not loaded & give some javascript error. when i commented the setting above in web.config file, there is no error & images loaded.
how i apply Form authentication in my application?
Thanks & Regards,
SAMir Nigam,
Software Engineer,
STPL, Lucknow, India.
|
|
|
|
|
I want to know that what`s mean by website cloning.
And how to perform it????
thanks
|
|
|
|
|
A clone is an exact copy. You perform it by writing code to create a website that looks and behaves like an existing one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am facing problem of COMException while opening MS-Word files using on Windows Server 2003. I am refering Interop.Word.dll for opening MS-Word files to count the number of words from it.
I am using following API to open the doc files.
Word.ApplicationClass wordApp = null;
Word.Document aDoc = null;
aDoc = wordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, <br /> ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, <br />ref missing, ref missing, ref missing, ref missing);
aDoc.Activate(); If I deploy above code on Windows 2000 professional then it works without error but if I deploy same code on Windows Server 2003 then I get following exception.
System.Runtime.InteropServices.COMException (0x800A1066): Command failed at <br /> Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,<br />Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, <br /> Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, <br /> Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)
Please tell me solution for it.
-- modified at 2:43 Saturday 19th May, 2007
#Abhi#
|
|
|
|
|
Dear Abhi
Have u refer microsoft.office 11.0 library ?
if not then refer it and then try on win server2003
best regards,
koolprasad2003
Be A Good S/W Eng... Life is swing with you..Enjoy..
|
|
|
|
|
Hi,
Hi i have some values in datagrid that are generating from database.I want to export those datas to flat file.Plz help me.I m working in ASP.net platform using VB.net
Thnks in advance
Jey
Graviton Solutions
|
|
|
|
|
|
how to place image (or) indicate new message arrived in DataGrid like in our codeoroject forum when we post new question it indicates new on that message
came out of hardwork
|
|
|
|
|
Hi there,
IMO, In the event OnItemDatabound...for each row you can append img tag if this is a new message arcording to your point...
<< >>
|
|
|
|
|
i am new to .net can u suggest me any example..so i can manage may self
came out of hardwork
|
|
|
|