ramondeklein / nwebdav Goto Github PK
View Code? Open in Web Editor NEW.NET implementation of the WebDAV protocol
License: MIT License
.NET implementation of the WebDAV protocol
License: MIT License
In Linux
System.IO.FileNotFoundException: Could not load file or assembly 'NWebDav.Server, Version=0.1.24.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
cause of real file name is nwebdav.server.dll
Renaming dll to NWebDav.Server.dll
helps
Windows does not care about registers.
In nuget package v.0.1.21.0 dll was named correct
Hello!
Maybe this is a default behaviour, but when i delete a file but i haven't the permissions for this operation, i'll get an exeption on the server, but the client gets no dialog that this operation can't be done.
Is this right?
Hi
Are you considering to post explicit licensing for this repository?
Thanks
hi
i want work with your package but i dont khow how start and methods your package have
Hello!
Do you have any exmple about the webdav server initialization?
I understood that I can create a store location in this way:
var store = new NWebDav.Server.Stores.DiskStore(@"C:\")
But I wasn't able, for example, to find out how to select a http listener (ip address + port) and how to start the server.
DAVExporer fails to connect to IIS NWebDav server and reports an XML parsing error. This apparently occurs because the XML declaration doesn't have a line separator after it. I fixed this using the following hack in ResponseHelpers.cs SendResponseAsync().
Replace
// Obtain the result as an XML document
using (var ms = new MemoryStream())
{
using (var xmlWriter = XmlWriter.Create(ms, new XmlWriterSettings
{
OmitXmlDeclaration = false,
with
// Obtain the result as an XML document
using (var ms = new MemoryStream())
{
var decl = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
ms.Write(decl, 0, decl.Length);
using (var xmlWriter = XmlWriter.Create(ms, new XmlWriterSettings
{
OmitXmlDeclaration = true,
Need support for base URL path, for example:
SourceLink can be added, so users can debug their own stores much more easy. More info on https://github.com/dotnet/sourcelink
First thank you implement open source WebDAV server, please add mvc 5 example with HttpHandler
i use under link
ms-word:ofv|u|https://xxxxxxx/webdav/y.doc
but open document Edit mode. I want Open Document On View Mode and user Fails Edit Document .
desktop word version is 2016
Github project license is MIT and nuget license is LGPL. Why so?
I am not able to edit and save a PPT file.
Hi,
I try to implement a WebDAV-Store, that loads data from another library from the net. That library provides the result only as a file on my file-System (temp-file). So whenever a user selects a file in my store, I Need to fetch the complete file first to my local hard drive and Can then provide a file-stream on it.
Is there any way to create a Kind of async-filestream that provides new data-chunks whenever they got written to the temp-file? I'm a bit lost, currently and appreciate any help.
Thank you!
Kind regards,
TopperDEL
WebDAV URLs seem to behave a little bit different from normal URLs, because they don't support fragments. This has been fixed (partially) in the UriHelper
class, but the store implementation needs to call this class at appropriate times which is a bit awkward and error-prone.
A custom URL class would probaby be easier to use, but this requires breaking changes to the API.
Hello Ramon, hello Community,
for various personal and professional reasons I am quite interested in pushing this project forward.
I created a pull request to upgrade to .NET5 (#60) and everybody is
welcome to review it - and make further improvements.
Very welcome is a diskussion if for example the usage if IAsyncCollection is sensible for GetItemsAsync()
Feel free to write here or contact me :)
Planning further contributions :)
For example:
Also I would ask the question if the support for .NET Standard 1.6 and 2.0 should be removed? (And Just Net 4.5, NetStandard 2.1 and Net5 (and Net6) should be left.
NWebDav.Sample.AspNet run on iis express or IIS with localhost(http://localhost/webdav). but when Run with localhost ip address(http://10.10.20.100/webdav).office word wait on load screen .
also in localhost send 4 request(options,head,Options,get) but on Ip address Only send 2 request (Options,Head)
Thanks for the guidance
I followed your HttpListener example to put up a Webdav server.
Everything works fine running it under Windows, but I get some issues running on linux with mono.
In the DispatchHttpRequestsAsync
function the request is intercepted and, with mono, the property IsAuthenticated
is alway False
, hance I'm not able to return the folder assigned to the user in the response.
Is there a workaround or a fix to this issue?
NWebDAV return 207 (Multi-Status) status code when trying to copy a file where destination file name is too long(320 chars).
In case of IIS if you you specify a destination file name greater than 256 characters, it returns 404 error status.
I've check the source code and found following code in CopyHandler, please have a look :
// Copy collection
await CopyAsync(sourceItem, destinationCollection, destination.Name, overwrite, depth, httpContext, destination.CollectionUri, errors).ConfigureAwait(false);
// Check if there are any errors
if (errors.HasItems)
{
// Obtain the status document
var xDocument = new XDocument(errors.GetXmlMultiStatus());
// Stream the document
await response.SendResponseAsync(DavStatusCode.MultiStatus, xDocument).ConfigureAwait(false);
}
else
{
// Set the response
response.SetStatus(DavStatusCode.Ok);
}
Try to copy a file where destination file name is greater than 256 characters.
Is this intended behaviors or is it a bug?
Add Asp.net Identity Core support can use roles authentication
add Entity Framework Core support that can manipulate files store in databases
MoveHandler move function for collections has no option to take advantage of moving a whole container, but instead creates a new container, moves contents one at a time, and then deletes the original.
I am working on a personal project that has an option for a GoogleDrive backing store. I would prefer to simply change the parent of the folder, retaining the ID of the folder itself.
https://github.com/ramondeklein/nwebdav/blob/master/NWebDav.Server/Handlers/MoveHandler.cs
This function:
private async Task MoveAsync(IStoreCollection sourceCollection, string sourceName, IStoreCollection destinationCollection, string destinationName, bool overwrite, IHttpContext httpContext, Uri baseUri, UriResultCollection errors)
I am happy to make the change in a branch and add a pull request, but would ideally like to coordinate on design.
My thinking is to add a function to IStoreCollection to check if a 'fast move' of a child collection is supported, and if so just tell it to use MoveItemAsync on the parent collection to do the move (the same as if it was a file). E.g. Task SupportsMovingCollections().
If I am just missing something and there is already an easier way, please let me know.
For example, NetBox Far plugin suppose that
server must send always, so all files and folders looks like files with zero length
Is it really problem of NetBox?
For logging it would be best to use DI instead of static objects and custom implementation of ILogger. MSFT already provides ILogger, extension methods, ILoggerFactory. Using your own definition of ILogger and ILogger factory does not integrate easily with the framework. At least use the MSFT interfaces but best would be to leverage DI as well so own does not have to handle the injection in the different classes (which is probably why you have the static)
I don't understand what does this mean "Recursive locking is not supported yet."
First it hanged webdav service, then i had to terminate process and connection (i use NetDrive), on second try it sends errors:
[11]: PROPFIND:http://127.0.0.1:801/temp:127.0.0.1:801 - Start processing
[11]: PROPFIND:http://127.0.0.1:801/temp:127.0.0.1:801 - Finished processing (70
1ms, HTTP result: 207)
[8]: GET:http://127.0.0.1:801/Cloud/unins000.exe:127.0.0.1:801 - Finished proces
sing (3511ms, HTTP result: 200)
[4]: Exception
System.ObjectDisposedException: Access to removed object is not possible.
Имя объекта: "System.Net.HttpListenerRequest".
в System.Net.HttpListenerRequest.CheckDisposed()
в System.Net.HttpListenerRequest.GetKnownHeader(HttpRequestHeader header)
в NWebDav.Server.HttpListener.HttpRequest.get_RemoteEndPoint()
в NWebDav.Server.WebDavDispatcher.<>c__DisplayClass6_0.<DispatchRequestAsync>
b__5()
в YaR.WebDavMailRu.Log4NetAdapter.Log4NetLoggerAdapter.Log(LogLevel logLevel,
Func`1 messageFunc, Exception exception)
в NWebDav.Server.WebDavDispatcher.<DispatchRequestAsync>d__6.MoveNext()
--- End of tracing stack from previous position, where exception triggered.
---
в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
в NWebDav.Server.WebDavDispatcher.<DispatchRequestAsync>d__6.MoveNext()
--- End of tracing stack from previous position, where exception triggered.
---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNoti
fication(Task task)
в YaR.WebDavMailRu.Program.<>c__DisplayClass3_0.<<DispatchHttpRequestsAsync>b
__1>d.MoveNext()
[5]: PROPFIND:http://127.0.0.1:801/temp:127.0.0.1:801 - Start processing
[3]: PROPFIND:http://127.0.0.1:801/temp:127.0.0.1:801 - Finished processing (319
ms, HTTP result: 207)
Slowly tries to download, but hangs and connection lost.
I use angular , I want set api token per Office Request.but I don't know set token when click ms-word:ofe Link and word open!!
Get 400 error.
WebDrive allow to map webdav folders as drive in windows (more usable than standart win webdav client).
Tested with NWebDav.Sample.HttpListener.
Experiments with changing properties of WebDrive connection does not take effect.
Move request of a non-existing files returns Status: 207(Multi-Status) instead of 404(Not Found).
Though I was able to confirm that Multi-Status response contains 404(Not Found) as an inner response as following :
<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n
<D:multistatus xmlns:D=\"DAV:\" xmlns:Z=\"urn:schemas-microsoft-com:\">\r\n
<D:response>\r\n
<D:href>https://172.21.2.220:5003/bbb</D:href>\r\n
<D:status>HTTP/1.1 404 Not Found</D:status>\r\n
</D:response>\r\n
</D:multistatus>
Make a move request where source file does not exist.
Is this intended behaviors or is it a bug?
Reproduction
File copied ok, but Far does not display it.
after d914594 shows all folders like files
how send web api token (jwt) on ms-word link?
when set api token on url (?token=xxxx) url long and word give exception.
You can give some advice?
Hi everybody and @ramondeklein
I would need an async lock manager since my locking would happen in a database and be asynchrouns calls.
The question is, now the ILockManager interface wouldn't allow that and I would need to replace the both Lock and Unlock Request handlers, if I would not want to do that I would need to execute all my async calls using LockAsync().Wait().
Think it would be best to make a incompatible fork? Or should I make a pull request for IAsyncLockManager?
I could add a IAsyncLock Manager Interface to the code, but then all Locking code would need a
if(LockManager is IAsyncLockManager)
await ((IAsyncLockManager)LockManager).LockAsync();
else
LockManager.Lock();
but that would make the sourcecode ugly?
When I open solution file project HelpTest can't be loaded.
Line 29 in 6c24b8e
i use under link
ms-word:ofv|u|https://xxxxxxx/webdav/y.doc
but open document Edit mode. I want Open Document On View Mode and user Fails Edit Document .
desktop word version is 2016
Implement https://datatracker.ietf.org/doc/html/rfc4918 instead of RFC2518
I'm trying to upload a file from Windows 10 to an instance webdav server, so I'm using the network folder method to connect the remote folder.
I noticed that with file with dimension >300MB the progress percentage of the copy action is not real: it goes straigh up to 99% with a reasonable upload speed, then it seems to stop but looking at the newly created file on the server store its dimension keeps on increasing till the copy is done.
Is this a Windows issue or something related on webdav server initialization?
When doing a PoC for MSOffice/LibreOffice editing feature while putting the documents on a WebDAV address pointed by a href links I noticed that the HTTP headers are not sent in case of GET requests.
NWebDav is hosted on ASP.NET (not Core).
To temporarily overcome the issue I had to add a flush method that flushes the content to the response before starting to write the actual content. The flush is called before the "if (!head) await CopyToAsync" statement in GetAndHeadHandler.cs.
I don't know if something similar is required for ASP.NET Core, HttpListener and for other HTTP verbs.
I suppose that it's TotalCommander (TC) bug, but other webdav servers works ok and... who knows.
Reproduction
... TC crushes
Or how can this be achieved?
Would you provide basic instructions for deploying on IIS?
I've mounted webdav server with davfs2 and cannot delete files..
yar@yarvm:~$ rm /mnt/wdmrc/favicon.ico
rm: remove write-protected regular file '/mnt/wdmrc/favicon.ico'? y
rm: cannot remove '/mnt/wdmrc/favicon.ico': Permission denied
Suppose I need to add some props to item DefaultPropertyManager?
Thanks for your answer
Is there any plans to implement this feature?
Thanks!
Thank you guys, I'm using your WebDav implementation inside a WebProject with a self-written DatabaseStore. I just tweaked the authentication to match my needs and I'm very happy with your implementation. You saved me a lot of time and I wanted to thank you for that.
If you supply Donation information I would love to support you.
NetBox Far plugin cannot create folder with name, for example, "#123"
If such folder already exists and you enter this one, all inner files and folders (include parent "..") looks like parent folder name.
But everything ok on, for example, webdav.yandex.ru
Also it's ok when webdav server mapped as disk drive
Other clients (Total Commander, CarotDAV) works normally
So correct me if I am wrong, currently it is locked by the user who has opened the document first and unless this user closes the document other user cannot edit and save the same document.
Is it possible to allow multiple users edit the same document and save ?
I can not open any word file anymore. Word gets stuck loading the file. My code looks like:
-solved-
When I click on any file inside the app WPS Office it shows a message that this download failed.
The ContentType property must be set instead of the header on ASP .Net 4.7.2, like this or similar:
public void SetHeaderValue(string header, string value)
{
if (header.Equals("content-type", System.StringComparison.OrdinalIgnoreCase))
{
_httpResponse.ContentType = value;
}
else
{
_httpResponse.Headers.Set(header, value);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.