Hello,
the following sub (below) reads an excel file to a webpage
using BinaryReader. If anyone tries to modify the excel
file from the browser this places the excel file in
ReadOnly mode, and no one can then touch the file, I can't
delete it, etc. The file will still display on the
browser. The only way I have been able to release the
file from ReadOnly mode is to reboot the server computer.
Obviously, I can't keep doing that. Does anyone know if
there is a way to reset/unset the ReadOnly mode of the
Excel file? or how to make it not go into ReadOnly mode?
------------------------------------------------------
Private Sub GetFile()
Dim FilePath As String = Cache("strFile" ).ToString
If Not Dir(FilePath).E quals("") Then
Dim fs As New FileStream(File Path, FileMode.Open,
FileAccess.Read )
Dim bw As New System.IO.Binar yReader(fs)
Dim byt() As Byte, i As Integer
byt = bw.ReadBytes(CI nt(fs.Length))
i = byt.Length()
Response.Conten tType = "applicatio n/vnd.ms-excel"
Response.Output Stream.Write(by t, 0, i)
Response.Output Stream.Close()
response.write( "testing")
End If
End Sub
----------------------------------------------------------
Thanks,
Ron 2 7527
"Ron" <an*******@disc ussions.microso ft.com> schrieb: the following sub (below) reads an excel file to a webpage using BinaryReader. If anyone tries to modify the excel file from the browser this places the excel file in ReadOnly mode, and no one can then touch the file, I can't delete it, etc. The file will still display on the browser. The only way I have been able to release the file from ReadOnly mode is to reboot the server computer. Obviously, I can't keep doing that. Does anyone know if there is a way to reset/unset the ReadOnly mode of the Excel file? or how to make it not go into ReadOnly mode?
You can try to specify 'FileShare.Read Write' in the constructor of your
'FileStream'. Maybe this helps.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Thanks. I will give that a try. -----Original Message----- "Ron" <an*******@disc ussions.microso ft.com> schrieb: the following sub (below) reads an excel file to a
webpage using BinaryReader. If anyone tries to modify the excel file from the browser this places the excel file in ReadOnly mode, and no one can then touch the file, I
can't delete it, etc. The file will still display on the browser. The only way I have been able to release the file from ReadOnly mode is to reboot the server
computer. Obviously, I can't keep doing that. Does anyone know if there is a way to reset/unset the ReadOnly mode of the Excel file? or how to make it not go into ReadOnly mode? You can try to specify 'FileShare.Read Write' in the
constructor of your'FileStream' . Maybe this helps.
-- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lawrence |
last post by:
Given a bunch of mixes variables, I'm in a situation where I can't
know what type they are.
Can I use unset to kill an object? unset($object);
Can I use unset to kill a pointer to an open file? unset($fp);
Can I use unset to kill a pointer to a database return?
unset($mySqlResult);
|
by: Ronny Sigo |
last post by:
Hello all,
As one of a few ways to let a user bring in data into my database I have
made 3 excel files.
Once the data are in the excel files my program checks if a required value
(Taal (Dutch) meaning Language) has been brought in. This value can only
have one of two values : N (for Nederlands - Dutch) and E (for English)
If a language in the excel has not been put in, the prog displays a warning.
After clicking the OK button of the...
|
by: PeteCresswell |
last post by:
I'm working on a new report in an MS Access DB.
The first anomaly was a message "This action will reset the current
code in break mode." when the report was run. Seems TB something
about my Detail1_Print(): if I answer "No" to the dialog the report
just runs. If I answer "Yes", it pops a new dialog seemingly at every
line. Code is below.
The real zinger, however, started on Friday. When I run the report
in question somehow MS...
|
by: fasanay |
last post by:
Hi everybody I have got the following PHP code which I am trying to convert to
ASP any help will be appreciated...I have done most of it but I cant find a
replace function for Unset in asp which will discard the variable alltogether...
if ($categoryid == "all")
{
$sql = "SELECT * FROM products where shopinspection=$shopinspection";
unset($HTTP_POST_VARS);
unset($HTTP_POST_VARS);
|
by: Luis Esteban Valencia |
last post by:
Here is my aspx code:
=============
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false"
Inherits="PDM.excel.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm3</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
| |
by: Suma |
last post by:
Hi
To open a notepad file, right now I am using Process.start. But this does not ensure that the file is opened in readonly mode
How can I make a notepad file open in Readonly mode
I do not want to change its attributes to Readonly
I do not want to open it in browser or in any other editor except notepad
I do not want to use MFCAppWizard of VC++ or VB to create my own editor.
I do not want to paste the text in some richtextbox...
|
by: comp.lang.php |
last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF
FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA
$_POST
if ($_POST && (!is_array($leaseObj->errorArray) ||
@sizeof($leaseObj->errorArray) == 0)) {
print_r(array_keys($_POST));
@reset($_POST);
$tempPost = $_POST;
foreach ($_POST as $key =$val) if (strpos($key, 'new_') === 0)
array_remove($tempPost, $tempPost);
|
by: Tim Zych |
last post by:
Is it possible to replace a VB.Net DLL (class library output), referenced by
an XL workbook, while the workbook is still open?
Right now, if Excel is open and referencing the DLL, it can't be replaced
until I close the workbook and also the containing XL app.
In the Setup and Deployment project, which is installing this solution, I
tried various ReadOnly attributes to get it to work, but Excel keeps a lock
on it.
|
by: Mayur H Chauhan |
last post by:
All,
I am working on one product where we need to check for physical file
is in use (if it is open by other application). What I found out is that I
am able to trap for those files whose attribute is not Set as ReadOnly. I
have done this by opening file using FileStream Object opening in Edit mode
with No Shared. But if I am try to apply same logic for ReadOnly files, then
it throws NonAuthorized exception. This exception is also raised...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |