Asp.net - Deleting A Folder On Another Thread Causes Webpage To Not Update?
Aug 8, 2011
I have a web app which displays a list of emails that need to be sent for the day. The user can select what emails to send, then click a button to generate them. When they click the Send button, a process gets started on another thread which generates the emails, then cleans up after itself by deleting a temp folder. Once the process is finished, the Repeater is rebound to update the User's view and remove the emails that have just been sent so they don't get sent again.
My problem is that when I delete the temp folder from my 2nd thread, the UI doesn't update with the new Repeater data. It updates correctly if I just delete the files in the folder instead of the folder itself, and it also updates correctly if I run the delete the folder on the original thread instead of the 2nd one.
New Thread code
Dim t as Thread = New Thread(New ThreadStart(AddressOf EmailLetters))
t.Start()
Delete folder code
Dim fs = Server.CreateObject("Scripting.FileSystemObject")
fs.DeleteFolder(Server.MapPath(".") + " mpEmailFiles")
Why won't the UI update to show the new repeater values when I delete a folder on another thread?
When you click the button, a thread gets started and a javascript load script starts executing which does a PostBack every 10 seconds. Each postback checks if the thread is complete and updates the Status label showing the result. If I delete a folder from within the background thread, the final update to the status label never occurs. If I remove the DeleteFolder call, it does.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ Import Namespace="System.Threading" %>
<%@ Page Language="VB" Debug="true" %>
[Code]....
View 2 Replies
ADVERTISEMENT
Dec 1, 2010
Now I upload update to a share folder inside the company network I have full
Permission access & everyone read onlyas any one out side the company can't use the program so there no password on the share folderbut I need now to protect the share folder as I have to use real IP on the database connection to allow the company branch's to access the database
View 1 Replies
Nov 18, 2009
I have a program that runs for some time and I would like to update the user on its progress. The rest of the GUI is updated using Delegates and Invokes and such (Java is Soooo much cleaner in this regard - everything is thread safe!!), but there is no invoke method for the progress bar. How can I use a delegate to update the progress bar when there is no invoke to invoke!!
View 1 Replies
Apr 5, 2012
If System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("images/TravelogueGallery/" & getMaxID())) Then
System.IO.Directory.Delete(HttpContext.Current.Server.MapPath("images/TravelogueGallery/" & getMaxID()), True)
End If
I am using the above code snippet to delete a directory but I get this error:
'G:ProjectsLatestLTCIndia 05-04-12 1415imagesTravelogueGallery19' is not a valid virtual path.
UPDATE: I have updated the question with the correct answer. The above code snippet works just fine.
View 1 Replies
Jul 3, 2010
vb 2008 on Vista: I have a folder called "Documents", and another called "PastDocuments". When the user deletes a client, I copy the contents of Documents into the Past Documents folder. Next, I need to delete the Documents folder, but there are existing files within that folder, so it won't let me delete it. What is the easiest way to delete ALL files within that folder?
View 1 Replies
Jul 17, 2009
im looking to delete all the files AND folders in My Documents. My things I do wont delete the folders.So I tried this, delete the My Documents folder instead, then recreate it.Here is the code I used.
'Delete MyDocs
My.Computer.FileSystem.DeleteDirectory("c:\Documents and Settings\CYSuser\My Documents\", _
Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, _
[code]....
Im getting the error
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Security authenications could not be handeled.
View 6 Replies
Dec 22, 2011
In my application I need to rename a folder ( in order to replace it) and then to delete it
[Code]...
View 15 Replies
Jul 6, 2009
I want to delete some resource components from resource folder of my vb.net project. When I do this, error is occurred during compile time. How can I do this while the project is not disturbed?
View 3 Replies
Apr 1, 2009
I have created a project where I can attach files and I am displaying the name of the file, example:
Mytestfile.doc
mytestfile.txt
Mytestfile.pdf
I have the names being displayed on a listbox, so far everything is working just the way I expected to work.When a file is selected from my opendialogbox, the file gets saved into a folder under my local disk, so far so good.The problem that I am having is deleting the file from the folder.I have added a delete button and I would like to when I click or highlight one of the file names to go into where the file was saved previously and deleted This is the code that I have for the delete funtion:
[CODE Dim sFileName As String = "C:program filesSupport DeskAttachments" & ListBox1.Text
System.IO.File.Delete(sFileName)][/code]
The problem is that if I add the code to the clcik event under the listbox, it works great, but if I add the code to the click event under my delete button, it doesn't work, what I found is that under the path, if I am under the click event from the listbox when it gets to the lisxtbox.text it displays the file name, which is what I whant, but when i tried the code under the click event under my delete button the listbox.text is blank.
View 3 Replies
Dec 17, 2009
I'm trying to delete a dll file in the system32 folder but receive a permission error (Access to the path 'c:\windows\system32\testfile.dll' is denied.)
I'm using:
[code...]
I have multiple versions of an app that uses a dll, I have to replace the dll with the correct version and register it. The plan was to delete it from system32, and copy over the relevant version, then register it.
View 1 Replies
Jun 10, 2010
I've been going round and round with this and thought maybe someone would know.I've created a program which with process.showdialog calls up a form into which the user enters username and password then is given access to the program itself. If the username and password is incorrect, the program closes.
There is a frmMain and in the form load I've added the process to open this sort of splash login screen. It's not a splash really, it isn't timed to close down.
I fill out the login information, click the save settings checkbox which creates a settings file in MyDocuments. My problem is that in debugging, removing the click closes the login page without the click actually becoming unclicked. The Main program opens before there's been a chance to register the "unclick." Hope this makes sense.
[Code]...
View 4 Replies
Apr 19, 2012
I am trying to write an application to delete files in a temp directory - so for example C:WindowsTemp
I need it to delete all files and subfolders (including all files in these subfolders) - but to NOT delete the top/root folder i.e. in this case Temp
I have tried
Dim fso, fldr
Set fso = CreateObject("Scripting.FilesystemObject")
Set fldr = fso.GetFolder("c:windows emp")
[Code].....
View 9 Replies
May 27, 2009
i'm currently working on making a program that does all my normal pc clean up work for me. delete temp files, tif, cookies prefetch etc and i'm using code like this
vb.net
Dim rKey As Microsoft.Win32.RegistryKey
Dim path As String
rKey =
[Code]....
I'm stuck in the cookiew folder since "index.dat" doesn't delete and it causes the form to crash.
View 8 Replies
Apr 25, 2010
Im trying to create a small program using the "toaster popup effect". I have the working. My problem is , i have a basic webpage here ( http://www.pro-coders.com/latestthreads.php ) that displays all the recent threads thats created on my forum, so i want to make this popup when theres a new thread to alert the users.How could i code it to automatically detect if a new thread has been posted from the webpage ?
View 2 Replies
Feb 17, 2011
I have created a service that will update a table. <foxpro to mysql>Before the update it will delete all the data in a table<mysql> and then insert the record from the dataset<from foxpro> one by one.I have more than 5000 records and it is very time consuming, now I would like to ask for some idea if there is a way in vb.net to only insert the data that have been recently added to the table<in foxpro> to mysql table. Is it possible in vb.net to know what has been added in the table?
View 3 Replies
Mar 28, 2011
I've made a dataset using the dataset designer, and I'm trying to add a column to reflect changes made to the database (added a column, nothing fancy). Is there a way to 'refresh' the dataset schema from the datasource without deleting my adapter (and all the methods and queries I've created)?
View 2 Replies
May 29, 2012
I am going to implements a thread pool to run my application. All of my content is saved under a folder on my desktop.
Each of the files are in .txt format. How can I read each .txt from a given folder and then put the .txt file into the thread pool / thread queue?
View 1 Replies
Jun 15, 2010
Im working on a program ( vb 2005 CE framework ). I have mainly two threads, the main one and another one I use it for a different thing.When I tried to update the UI this exception was thrown : Control.Invoke must be used to interact with controls created on a separate thread.well !I have tried to use the INVOKE, but it wouldn't work. this is where I get the error :
Public Sub PaintKeys()
Dim tempLevel As clsLevel
Dim tempKey As ClsKey
[code]....
View 5 Replies
May 29, 2012
I am going to implements a thread pool to run my application. All of my content is saved under a folder on my desktop.Each of the files are in .txt format. How can I read each .txt from a given folder and then put the .txt file into the thread pool / thread queue?
View 2 Replies
Jun 1, 2009
I'm trying to design a small program for my home server that automatically updates an HTML page every time a new file is added to a certain directory.Example, say I already have 100 files in "C:Folder", and on the HTML page, all those files are listed in a table, and when you click on one of them, the file opens, say I add a new file to the folder, I want the program to automatically add that file to the list of other files, and put *NEW* next to it (newfile.txt *NEW*), and I would like it to say *NEW* for 5 days, so how would I go about making a program that does all that?
View 3 Replies
Dec 20, 2011
I have a link on a VB.net aspx page that needs to open a folder in a subdirectory of a web site and provide read and write permissions so that files can be copied into and read from as well as deleted. ONLY from this folder.I have this funtionality working on a dev and demo PC but they are both on my domain. Clicking the link opens Windows Explorer and I can copy /cut & Paste, etc.The public/production PC is on the LAN, but not part of the domain. I know there are ways to allow folder read/write permissions on a public server like this but I am not too sure on the safest way to do this. The upside, the only users that need to have read/write/delete access are employees. Forms Authentication, ASP Membership directs non-employees to other pages within the site. Likewise, the membership directs employees to an admin section of the site.
View 1 Replies
Jun 22, 2012
The usual VB way to handle a computationally heavy task is to put it in a background worker thread, while the main thread keeps handling the UI.Say for whatever reason I needed to do this the other way around: the main thread doing the grunt work and the background one updating the UI.Here's what I have so far. The only problem is, while the UI window (Form1) does get redrawn, you can't interact with it, not even move or resize it (the mouse cursor turns to hourglass and won't click).
Public Class ProgressDisplay
Private trd As Thread
Public Sub New()
trd = New Thread(AddressOf threadtask)
[code]....
The client will call it like this (actually in unmanaged c++ over COM but you get the picture):
Dim prog = new ProgressDisplay()
DoLotsOfWork(addressof prog.update) ' DoLotsOfWork method takes a callback argument to keep client informed of progress
View 3 Replies
Dec 7, 2010
below is a small part of my asynchronous TCP connection code. When I connect I'm passing a ListViewItem as Object parameter. I'd like to update the ListViewItem once the connection has been established or an error occurs. ServerConnect runs on a separate thread, because it's an asynchronous connection, so I can't update the ListViewItem directly.
Does anybody know how to update the ListViewItem?
I looked at jmcilhinney's asynchronous TCP example in the Codebank forum, but it confused me. I don't know which parts I need and which parts I don't need.
::edit::
One more thing. I also need to update the ListViewItem in the Read sub, but I'm passing "buffer" as Object, so how would I update the ListViewItem there?
vb.net
Imports System.Net.Sockets
Public Class TCP
Private Socket As TcpClient
[Code].....
View 8 Replies
Apr 22, 2012
I am trying to write an app that in the thread will do some tasks, the form lokks like this:and what it should is something like this:
- retrieve data, populate a row in the listview, increase the first progress bar
- retrieve data, populate a row in the listview, increase the first progress bar
- retrieve data, populate a row in the listview, increase the first progress bar
[code]....
View 2 Replies
May 28, 2011
How can I update the text in tab control so that it displays the title of a webpage?
View 12 Replies
Nov 2, 2011
Basic function - enter 5-10 urls. Download all web pages using multi threads and then process it. Then in the end, the text from all threads should end up in a richtextbox. It can't be done using any of my googly searches so i thought about asking this :
how would you update text in a richtextbox from a different thread?
I am being able to download and process web pages. But can't add it to richtextbox.
View 2 Replies
Jul 26, 2011
I have a TCP server app that starts 2 threads when the server is activated, I want the threads to add text to the textbox on the main form. Here's is what I have tried [code]I have added MsgBoxes at points so I know the Sub updatetext_ is being called, and the text is being passed, they are also showing that InvokeRequired is always FALSE. In any case the textbox txtMessages is not being updated.
View 11 Replies
May 9, 2010
I've looked at the on line doc over and over, and I can't seem to figure out why this won't work. This code runs the thread, and the thread seems to execute the code in the 'threadsafe' sub, however neither the progress bar is updated or the button click performed.
Imports System.Threading
Public Class VisNotify
Inherits Form
[Code].....
View 4 Replies
Sep 1, 2009
I'm not sure exactly how to describe this. In VB6, there was a Timer command. I could create a variable of type Timer and loop until the current value for Timer exceeded the initial plus a given amount of time. This allowed me to update form variables while the timing loop was executing. How can I do something similar in .NET?[code]...
View 5 Replies
Oct 20, 2010
I am new to multi-threading in VB.NET and have come across a problem whereby I am wanting to append text to a text box on a form from a service thread running in the background.
The application I am developing is a client/server listener, I have been able to get the client and server PC's to talk with each other (confirmed through MsgBox), however I am now struggling to get the service thread on the server to append the text to the textbox, nothing vissible occurs.
I have a form named testDebug which calls a class (RemoteSupport), this class does all the handshake tasks and updates the textbox with the connection data.[code]...
View 2 Replies