473,795 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change file summary (title, author, etc.)

Hello,

I am having some sort of security issue with my code. When I change a
file's title in a Windows or console app, I have no problems. (I am using
Microsoft's article & DsoFile.dll:
http://support.microsoft.com/default...b;en-us;224351)

When I run it in ASP.NET, I get a "file not found" exception, even though
the file does exist.

Here is what I have already tried within ASP.NET:
1. Launch the code in a console app in a separate process.
2. Launch the code as a web service...didn' t think this would work since
it's under IIS's jurisdiction as well, but tried anyway.
3. Both of the above two options while impersonating an admin account.
4. Steps 1 and 2 after fully trusting the assemblies (meaning every assembly
in my solution).

Here is my code:

Dim oSummProps As DSOFile.Summary Properties
Dim oCustProp As DSOFile.CustomP roperty
Dim sFile, sTmp As String
Dim m_oDocument As DSOFile.OleDocu mentPropertiesC lass

m_oDocument = New DSOFile.OleDocu mentPropertiesC lass
' Note: fileName is just a local file...in this case, c:\test.txt.
m_oDocument.Ope n(fileName, False, _
DSOFile.dsoFile OpenOptions.dso OptionOpenReadO nlyIfNoWriteAcc ess)

If Not m_oDocument.IsR eadOnly Then
oSummProps = m_oDocument.Sum maryProperties
oSummProps.Titl e = myNewTitle
m_oDocument.Sav e()
End If
m_oDocument.Clo se()
m_oDocument = Nothing

Does anybody know what to do here?

Thank you!

Eric

Nov 19 '05 #1
4 4133
Likely permissions. See under whihc account runs your app and give this
account the appropriate rights or use another directory...

A tool such as filemon from www.sysinternals.com may help to diagnose file
access problmes in case your configuration should work but still fails...

--
Patrice

"Eric" <Er**@discussio ns.microsoft.co m> a écrit dans le message de
news:33******** *************** ***********@mic rosoft.com...
Hello,

I am having some sort of security issue with my code. When I change a
file's title in a Windows or console app, I have no problems. (I am using
Microsoft's article & DsoFile.dll:
http://support.microsoft.com/default...b;en-us;224351)

When I run it in ASP.NET, I get a "file not found" exception, even though
the file does exist.

Here is what I have already tried within ASP.NET:
1. Launch the code in a console app in a separate process.
2. Launch the code as a web service...didn' t think this would work since
it's under IIS's jurisdiction as well, but tried anyway.
3. Both of the above two options while impersonating an admin account.
4. Steps 1 and 2 after fully trusting the assemblies (meaning every assembly in my solution).

Here is my code:

Dim oSummProps As DSOFile.Summary Properties
Dim oCustProp As DSOFile.CustomP roperty
Dim sFile, sTmp As String
Dim m_oDocument As DSOFile.OleDocu mentPropertiesC lass

m_oDocument = New DSOFile.OleDocu mentPropertiesC lass
' Note: fileName is just a local file...in this case, c:\test.txt.
m_oDocument.Ope n(fileName, False, _
DSOFile.dsoFile OpenOptions.dso OptionOpenReadO nlyIfNoWriteAcc ess)

If Not m_oDocument.IsR eadOnly Then
oSummProps = m_oDocument.Sum maryProperties
oSummProps.Titl e = myNewTitle
m_oDocument.Sav e()
End If
m_oDocument.Clo se()
m_oDocument = Nothing

Does anybody know what to do here?

Thank you!

Eric

Nov 19 '05 #2
On Tue, 11 Oct 2005 05:46:02 -0700, "Eric" <Er**@discussio ns.microsoft.co m> wrote:

¤ Hello,
¤
¤ I am having some sort of security issue with my code. When I change a
¤ file's title in a Windows or console app, I have no problems. (I am using
¤ Microsoft's article & DsoFile.dll:
¤ http://support.microsoft.com/default...b;en-us;224351)
¤
¤ When I run it in ASP.NET, I get a "file not found" exception, even though
¤ the file does exist.
¤
¤ Here is what I have already tried within ASP.NET:
¤ 1. Launch the code in a console app in a separate process.
¤ 2. Launch the code as a web service...didn' t think this would work since
¤ it's under IIS's jurisdiction as well, but tried anyway.
¤ 3. Both of the above two options while impersonating an admin account.
¤ 4. Steps 1 and 2 after fully trusting the assemblies (meaning every assembly
¤ in my solution).
¤
¤ Here is my code:
¤
¤ Dim oSummProps As DSOFile.Summary Properties
¤ Dim oCustProp As DSOFile.CustomP roperty
¤ Dim sFile, sTmp As String
¤ Dim m_oDocument As DSOFile.OleDocu mentPropertiesC lass
¤
¤ m_oDocument = New DSOFile.OleDocu mentPropertiesC lass
¤ ' Note: fileName is just a local file...in this case, c:\test.txt.
¤ m_oDocument.Ope n(fileName, False, _
¤ DSOFile.dsoFile OpenOptions.dso OptionOpenReadO nlyIfNoWriteAcc ess)
¤
¤ If Not m_oDocument.IsR eadOnly Then
¤ oSummProps = m_oDocument.Sum maryProperties
¤ oSummProps.Titl e = myNewTitle
¤ m_oDocument.Sav e()
¤ End If
¤ m_oDocument.Clo se()
¤ m_oDocument = Nothing
¤
¤ Does anybody know what to do here?

I would agree that there is a permissions problem. It isn't clear though where these files are
located or how you have implemented impersonation in your web application.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #3
Thank you for your replies, Patrice and Paul.

I think you two nudged me a little in the right direction...not quite there
yet, but close. I explicitly set the NTFS permissions on the directory to
allow the ASPNET account full access. Now, instead of the "file not found"
exception, I get "System.Unautho rizedAccessExce pÂ*tion: Access is denied." on
the following line of code:

oSummProps.Titl e = myNewTitle

Therefore, I was able to open the file, and it was not read-only. (If you
don't have read/write access, it still opens the file as read-only.)

And Patrice, I took your advice with the filemon...it shows a successful
CREATE request and a successful CLOSE request. Unfortunately, the attempt to
set the title in the line of code above is not logged.

Also, I took the advice of Ken Cox (http://tinyurl.com/7sleo) to change the
ASPNET account from machine to SYSTEM, but that didn't seem to have any
greater effect.

Any other ideas?

Thanks again!

Eric
"Paul Clement" wrote:
On Tue, 11 Oct 2005 05:46:02 -0700, "Eric" <Er**@discussio ns.microsoft.co m> wrote:

¤ Hello,
¤
¤ I am having some sort of security issue with my code. When I change a
¤ file's title in a Windows or console app, I have no problems. (I am using
¤ Microsoft's article & DsoFile.dll:
¤ http://support.microsoft.com/default...b;en-us;224351)
¤
¤ When I run it in ASP.NET, I get a "file not found" exception, even though
¤ the file does exist.
¤
¤ Here is what I have already tried within ASP.NET:
¤ 1. Launch the code in a console app in a separate process.
¤ 2. Launch the code as a web service...didn' t think this would work since
¤ it's under IIS's jurisdiction as well, but tried anyway.
¤ 3. Both of the above two options while impersonating an admin account.
¤ 4. Steps 1 and 2 after fully trusting the assemblies (meaning every assembly
¤ in my solution).
¤
¤ Here is my code:
¤
¤ Dim oSummProps As DSOFile.Summary Properties
¤ Dim oCustProp As DSOFile.CustomP roperty
¤ Dim sFile, sTmp As String
¤ Dim m_oDocument As DSOFile.OleDocu mentPropertiesC lass
¤
¤ m_oDocument = New DSOFile.OleDocu mentPropertiesC lass
¤ ' Note: fileName is just a local file...in this case, c:\test.txt.
¤ m_oDocument.Ope n(fileName, False, _
¤ DSOFile.dsoFile OpenOptions.dso OptionOpenReadO nlyIfNoWriteAcc ess)
¤
¤ If Not m_oDocument.IsR eadOnly Then
¤ oSummProps = m_oDocument.Sum maryProperties
¤ oSummProps.Titl e = myNewTitle
¤ m_oDocument.Sav e()
¤ End If
¤ m_oDocument.Clo se()
¤ m_oDocument = Nothing
¤
¤ Does anybody know what to do here?

I would agree that there is a permissions problem. It isn't clear though where these files are
located or how you have implemented impersonation in your web application.
Paul
~~~~
Microsoft MVP (Visual Basic)

Nov 19 '05 #4
On Tue, 11 Oct 2005 10:04:10 -0700, "Eric" <Er**@discussio ns.microsoft.co m> wrote:

¤ Thank you for your replies, Patrice and Paul.
¤
¤ I think you two nudged me a little in the right direction...not quite there
¤ yet, but close. I explicitly set the NTFS permissions on the directory to
¤ allow the ASPNET account full access. Now, instead of the "file not found"
¤ exception, I get "System.Unautho rizedAccessExce p*tion: Access is denied." on
¤ the following line of code:
¤
¤ oSummProps.Titl e = myNewTitle
¤
¤ Therefore, I was able to open the file, and it was not read-only. (If you
¤ don't have read/write access, it still opens the file as read-only.)
¤
¤ And Patrice, I took your advice with the filemon...it shows a successful
¤ CREATE request and a successful CLOSE request. Unfortunately, the attempt to
¤ set the title in the line of code above is not logged.
¤
¤ Also, I took the advice of Ken Cox (http://tinyurl.com/7sleo) to change the
¤ ASPNET account from machine to SYSTEM, but that didn't seem to have any
¤ greater effect.
¤
¤ Any other ideas?

OK, well I have same two questions as in my prior reply but I will be more specific. ;-)

How did you implement impersonation? Did you enable the option in web.config? Are you impersonating
the authenticated user (via Integrated Windows or Basic auth)?

Where are the files located? Are they on the web server or a remote network machine?
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #5

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

Similar topics

2
10302
by: Anthony Liu | last post by:
I copy-pasted the following sample xml document from http://slis-two.lis.fsu.edu/~xml/sample.html and saved it as samplexml.xml. Please note that I removed the following line <!DOCTYPE DOCUMENT SYSTEM "simple.dtd"> from the original xml sample. <?XML version="1.0" encoding="UTF-8"?>
1
1278
by: K R | last post by:
Hi, I have generated this XML from my application. But, when I open this XML, it is throwing error. Please help me to resolve this. <?xml version="1.0" encoding="utf-8" ?> <searchResults> <totalhits>16916</totalhits> <searchquery>*</searchquery> <timetaken>TIME TAKEN</timetaken>
3
1545
by: K R | last post by:
Hi, I have generated this XML from my application. But, when I open this XML, it is throwing error. Please help me to resolve this. <?xml version="1.0" encoding="utf-8" ?> <searchResults> <totalhits>16916</totalhits> <searchquery>*</searchquery> <timetaken>TIME TAKEN</timetaken>
2
6092
by: Santosh | last post by:
When you right click on file and select properties option, some files have "Summary" tab. Using ApplicationInfo.cs file we can set "Company","Language","Version" etc.. which appeares under Version tab. But how can I set "Author","Category","Title","Subject",e.t.c from AssemblyInfo.cs file which appeares under Summary tab?
5
9863
by: Ram [MSFT] | last post by:
Hi All, I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a file). FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..). Any pointers would be greatly appreciated. Thanks, Ram Thiru
0
1451
by: MS | last post by:
Is the schema used to validate XML Documentation Comments available to be changed by a VS.Net user? I suspect the this question is no so have a couple of requests: 1.) I use #region extensively along with the Outlining key functions to organize and navigate my code. In general, having an uncatagorized list of undifferentiated declarations in the generated HTML documentation is not all that helpful. Please have VS.Net do one of the...
1
1090
by: Michael Reynolds | last post by:
I can read file attributes just fine (author, title, etc,) But there's no way to update them. I know windows application can do it, but can a web application update these file attributes? Here's the code I'm using: Dim oSummProps As DSOFile.SummaryProperties Dim oCustProp As DSOFile.CustomProperty
6
6317
by: Mag Gam | last post by:
Hi All, I am new to XML, and trying to extract some data from a file. The file looks like this: <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY>
7
11790
by: ianenis.tiryaki | last post by:
well i got this assignment which i dont even have a clue what i am supposed to do. it is about reading me data from the file and load them into a parallel array here is the question: Step (1) Your first task is to write a program which reads this file into two parallel arrays in memory. One array contains the titles, and the other array contains the authors. The arrays are 'parallel' in the sense that the n-th element of the authors...
0
9673
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
9522
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,...
0
10217
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...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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
9046
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
7544
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
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2922
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.