473,770 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read protect excel using aspnet

Hi,

I wonder if it is possible to read the content of an excel spreadsheet
through aspnet. The spreadsheet (workbook) is protected and it resides
in a network drive.

Please provide sample code if possible. Thanks in advance. Your help
is greatly appreciated.

Feb 23 '07 #1
11 2204
<sw**********@y ahoo.comwrote in message
news:11******** *************@j 27g2000cwj.goog legroups.com...
Please provide sample code if possible.
Unfortunately, the fact that the workbook has a password means that it can't
be opened via ADO.NET: http://support.microsoft.com/kb/211378/EN-US/

Therefore, your only option is to use Aspose:
http://www.aspose.com/Products/Aspos...s/Default.aspx

Don't even think of trying to use Office automation:
http://support.microsoft.com/default...US;q257757#kb2
Feb 23 '07 #2
What if it is not password protected, is it possible to read the
sheets (more than 1) in the workbook and how can this be done?

Thanks.

On Feb 23, 9:10 am, "Mark Rae" <m...@markNOSPA Mrae.comwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** *************@j 27g2000cwj.goog legroups.com...
Please provide sample code if possible.

Unfortunately, the fact that the workbook has a password means that it can't
be opened via ADO.NET:http://support.microsoft.com/kb/211378/EN-US/

Therefore, your only option is to use Aspose:http://www.aspose.com/Products/Aspos...s/Default.aspx

Don't even think of trying to use Office automation:http://support.microsoft.com/default...US;q257757#kb2

Feb 23 '07 #3
<sw**********@y ahoo.comwrote in message
news:11******** *************@8 g2000cwh.google groups.com...
What if it is not password protected, is it possible to read the
sheets (more than 1) in the workbook and how can this be done?
http://www.google.co.uk/search?sourc...DO%2eNET+Excel
Feb 23 '07 #4
On Feb 23, 12:36 pm, "Mark Rae" <m...@markNOSPA Mrae.comwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** *************@8 g2000cwh.google groups.com...
What if it is not password protected, is it possible to read the
sheets (more than 1) in the workbook and how can this be done?

http://www.google.co.uk/search?sourc...ie=UTF-8&rls=G...

Thanks for your advice, but I am getting the following error once
objConn.Open is executed

System.Data.Ole Db.OleDbExcepti on: Unspecified error

Dim sConnectionStri ng As String = "Provider=Micro soft.Jet.OLEDB. 4.0;"
_
& "Data Source=C:\test. xls" _
& ";" & "Extended Properties=Exce l 11.0;"

' Create the connection object by using the preceding
connection string.
Dim objConn As New OleDbConnection (sConnectionStr ing)

' Open connection with the database.
objConn.Open()

Is it something to do with the Extended Properties? I have been trying
8.0 to 11.0, but none of them work. The file is created through MS
Excel 2003. Or something is missing on the machine?

Please help. Your help is greatly appreciated.

Mar 7 '07 #5
<sw**********@y ahoo.comwrote in message
news:11******** **************@ q40g2000cwq.goo glegroups.com.. .
Thanks for your advice, but I am getting the following error once
objConn.Open is executed

System.Data.Ole Db.OleDbExcepti on: Unspecified error

Dim sConnectionStri ng As String = "Provider=Micro soft.Jet.OLEDB. 4.0;"
_
& "Data Source=C:\test. xls" _
& ";" & "Extended Properties=Exce l 11.0;"

' Create the connection object by using the preceding
connection string.
Dim objConn As New OleDbConnection (sConnectionStr ing)

' Open connection with the database.
objConn.Open()

Is it something to do with the Extended Properties?
You need to catch the exception and then inspect the inner exception to find
out what precisely is going wrong...

Also, is text.xls actually present in the root directory of your
webserver...?

Mar 7 '07 #6
On Mar 7, 4:07 am, "Mark Rae" <m...@markNOSPA Mrae.comwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** **************@ q40g2000cwq.goo glegroups.com.. .


Thanks for your advice, but I am getting the following error once
objConn.Open is executed
System.Data.Ole Db.OleDbExcepti on: Unspecified error
Dim sConnectionStri ng As String = "Provider=Micro soft.Jet.OLEDB. 4.0;"
_
& "Data Source=C:\test. xls" _
& ";" & "Extended Properties=Exce l11.0;"
' Create the connection object by using the preceding
connection string.
Dim objConn As New OleDbConnection (sConnectionStr ing)
' Open connection with the database.
objConn.Open()
Is it something to do with the Extended Properties?

You need to catch the exception and then inspect the inner exception to find
out what precisely is going wrong...

Also, is text.xls actually present in the root directory of your
webserver...?- Hide quoted text -

- Show quoted text -

No luck, unfortunately, I have moved the test.xls to the root
directory of the web application (see below)

Dim sConnectionStri ng As String =
"Provider=Micro soft.Jet.OLEDB. 4.0;" _
& "Data Source=" &
Server.MapPath( "./test.xls") _
& ";" & "Extended Properties=Exce l
11.0;"

And I try to catch the exception but I am still getting "Unspecifie d
error "
Try
objConn.Open()
Catch ex As Exception
Page.RegisterSt artupScript("Ca nnot Open",
"<script>window .alert('" & (ex.Message.ToS tring) & "' );</script>")
Exit Sub
End Try

Please help. I really need to get this resolved. Many thanks.

Mar 7 '07 #7
<sw**********@y ahoo.comwrote in message
news:11******** **************@ 30g2000cwc.goog legroups.com...
And I try to catch the exception but I am still getting "Unspecifie d
error "
Try
objConn.Open()
Catch ex As Exception
Page.RegisterSt artupScript("Ca nnot Open",
"<script>window .alert('" & (ex.Message.ToS tring) & "' );</script>")
Exit Sub
End Try

Please help. I really need to get this resolved. Many thanks.
Like I said, you need to interrogate the InnerException property of the
Exception object, not the Message property...
Mar 7 '07 #8
On Mar 7, 9:28 am, "Mark Rae" <m...@markNOSPA Mrae.comwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** **************@ 30g2000cwc.goog legroups.com...
And I try to catch the exception but I am still getting "Unspecifie d
error "
Try
objConn.Open()
Catch ex As Exception
Page.RegisterSt artupScript("Ca nnot Open",
"<script>window .alert('" & (ex.Message.ToS tring) & "' );</script>")
Exit Sub
End Try
Please help. I really need to get this resolved. Many thanks.

Like I said, you need to interrogate the InnerException property of the
Exception object, not the Message property...

I have something like this, but "InnerExcep tion Is Nothing", so I
can't any message at all. Please help!!!

Try
objConn.Open()
Catch ex As Exception
'lblError.Text = ex.Message.ToSt ring

If Not (ex.InnerExcept ion Is Nothing) Then
Page.RegisterSt artupScript("Ca nnot Open",
"<script>window .alert('" & (ex.InnerExcept ion.ToString) & "' );</
script>")
End If
Exit Sub
End Try

Mar 7 '07 #9
<sw**********@y ahoo.comwrote in message
news:11******** **************@ n33g2000cwc.goo glegroups.com.. .
I have something like this, but "InnerExcep tion Is Nothing", so I
can't any message at all. Please help!!!
In which case, I'm at a bit of a loss...

This error is well enough documented on Google:
http://www.google.co.uk/search?hl=en...22+Excel&meta=

Has nothing there helped...?
Mar 7 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1529
by: Zed | last post by:
I have a problem with .net writing to a remote server that I need to deploy on. The app works fine on my local machine. But when got access to the server I went to VS.NET and tried to create a project the regular way, I got this message "The web was created successfully, but an error occurred when trying to configure the application root for this web. Web projects may not operate correctly without application root. The returned error was:...
1
4562
by: Giganews | last post by:
I have an Access 97 database in which I am running an Excel macro through automation. The macro in Excel is as follows: Worksheets("Sheet1").Protect Password:="****", DrawingObjects:=True, Contents:=True, Scenarios:=True When I call this macro from the database all works fine except when I recorded the macro I deselected the "Select locked cells" option under the "Allow all users of this worksheet to:" section but yet when I access the...
1
1840
by: sk | last post by:
Please forgive me if the same topic is already posted. But i havent found I have got an error while accessing the excel file as below. Can somebody reply if there is a solution Access is denied. Exception Details: System.UnauthorizedAccessException: Access is denied. The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited...
9
4437
by: hari krishna | last post by:
hi, I want to send the data from dataset information to Excel through ASP.Net. there will be no XL installed on web server. web server is win 2000 server machine. I am using visual basic code in asp.net. The Xl sheet should not be opened in the browser. All the information from dataset(datatable,datarows) should be sent to XL and the file name should be given dynamically through program and the xl file should be saved dynamically through...
8
2183
by: jack | last post by:
Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET...
5
1581
by: Graham | last post by:
I have been asked by a client to produce a proof of concept of how .Net performs and works within an Excel workbook. Everything works perfectly with all the required events firing and data being read from the correct cells. I sent this to the client and he is happy but asked some questions, and Im not too sure on the answers (he is an old school VBA developer at heart and doesn't know anything about .Net): ...
3
5085
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, Is there anything wrong with the code below in sending my browser page to Excel? Before my page opens in Excel there's a message "Problems came up in the following areas during load:" and it shows a CSS file in the "temporary internet files" path. But when i click OK the page displays beautifully. Even though my page has 3 datagrids, they all display with the same style as seen in the browser page. Though, the second problem is,...
7
2344
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want to prevent other websites from serving my image. For example - How can I prevent another website from doing this? <img src="http://mywebsitename/images/image1.jpg" Is this possible? Thanks
2
5653
by: RohitGBhagwat | last post by:
Hi, I am New To ASP.Net and I have created a small application in ASP.Net using C# which is a reporting Tool. In this Application I have to Edit an Excel File on a Weekly basis and for that i am using Excel.Application in ASP.Net. But on the First Line itself I am getting Error Message Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005. I have...
0
9602
marktang
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...
0
10237
Oralloy
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...
0
10071
jinu1996
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...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
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...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
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
3
2832
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.