Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2008, 10:56 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default File read problem...

Hi All,

I have a problem in my page. i am using below code to read the content of a file.

in the page load methid i am writing this code.

 Dim sLine() As String = File.ReadAllLines(sLicenseFile)


 it works fine when single user access the page.

 But problem occurs when another user try to access the page then it kill the prosessing of first use.


 any idea why this is happening.

 and if i remove this line of code then application works fine. both the user can access

 the application at the same time.


 what else i can do to read the file. i have tried 'Streamreader' also but the same problem.

 Dim objSR As StreamReader = New StreamReader(sLicenseFile)
                Dim sLine As String = objSR.ReadLine()
                objSR.Close()
                objSR = Nothing



 please shed some light on it

 Thanks
 
Old September 9th, 2008, 11:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there..

what do you mean by kill?? the first process hangs up?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old September 9th, 2008, 11:11 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You don't say what 'problem' you are having. I'm assuming this is an Exception which is thrown, but what is it?

The key method to call on the StreamReader if you do use it is Dispose. Alternatively you can use the "Using" syntax:

Code:
Using objSR As StreamReader = New StreamReader(sLicenseFile)
   ...
End Using
/- Sam Judson : Wrox Technical Editor -/
 
Old September 9th, 2008, 11:43 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Thanks for your replying.

first user's processing get crashed. means it stops the processing
of first user.
 
Old September 9th, 2008, 12:18 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Ok. What error do you receive when it crash??

can you use a try catch for clean any error?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem while file read watashi C++ Programming 1 November 5th, 2007 05:46 AM
Read Text file and convert to Binary file VB.net sjlsysprg1 Pro VB.NET 2002/2003 4 June 29th, 2007 06:53 AM
how to read file vivekkumar_23 Java Basics 1 April 3rd, 2006 10:03 AM
How to Read from INI file alen Pro VB 6 2 September 3rd, 2004 06:34 AM
can't read file nikolaosk BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 July 28th, 2003 04:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.