Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8829635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:52:46+00:00 2026-06-14T07:52:46+00:00

How can I force a file to be opened in read-only mode in cases

  • 0
  1. How can I force a file to be opened in read-only mode in cases where a certain custom document status applies? For instance, a document can go through various stages: created, reviewed, approved. Once it’s approved nobody can modify it.

  2. How do I tell a client through the WebDAV Server Engine for .NET api that certain operations are not supported, for instance moving and copying files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:52:48+00:00Added an answer on June 14, 2026 at 7:52 am

    If you want to forbid copy and move operations in all cases, do it this way:

    public override void CopyTo(IItemCollection folder, string destName, bool deep, MultistatusException multistatus)
    {
        throw new DavException("Cannot copy resource", DavStatus.NOT_ALLOWED);
    }
    
    public override void MoveTo(IItemCollection folder, string destName, MultistatusException multistatus)
    {
        throw new DavException("Cannot move resource", DavStatus.NOT_ALLOWED);
    }
    

    If you want to forbid copy/move/change a resource basing on some condition, I’ll recommend you to use custom handlers:

    public Service(ILogger logger, bool isApplication)
    {
        ...
        MyCustomPutHandler handler = new MyCustomPutHandler();
        handler.OriginalHandler = engine.RegisterMethodHandler("PUT", handler);
    }
    
    internal class MyCustomPutHandler : IMethodHandler
    {
        public IMethodHandler OriginalHandler { get; set; }
    
        public void ProcessRequest(DavContextBase context, IHierarchyItem item)
        {
            if(<check condition>)
            {
                throw new DavException("Cannot change resource", DavStatus.Conflict);
            }
            if (item is IFolder)
            {
                ...
            }
            else
            {
                OriginalHandler.ProcessRequest(context, item);
            }
        }
         ......
    }
    

    Hope this will help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I've got my normal app which is in portrait mode. I can force
can I force the DBML designer to use my custom types instead of the
How can I force the save file download dialog box when I click an
On Visual studio I can force use of 32-bit time_t by declaring _USE_32BIT_TIME_T .
Hi I want to make a small test window app that can force IE
Using Castle ActiveRecord / NHibernate: Is there a way you can force an ICriterion
I've been trying to figure WIF out for a while now, and can force
Can I force the gcc to use a null canary or terminator canary, when
How can I force validation when user clicks button? One would think this should
How Can i force one Mootools ToolTip (Tip) to Open? Regards, Pedro

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.