webdav protal office 365 fix
This commit is contained in:
parent
92befdea38
commit
f2c54df2b0
27 changed files with 466 additions and 80 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
@ -6,6 +7,7 @@ using System.Net.Security;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Exceptions;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core
|
||||
|
@ -18,6 +20,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
IFolder CreateFolder(string name);
|
||||
IHierarchyItem[] GetChildren();
|
||||
IResource GetResource(string name);
|
||||
Uri Path { get; }
|
||||
}
|
||||
|
||||
public class WebDavFolder : WebDavHierarchyItem, IFolder
|
||||
|
@ -25,6 +28,8 @@ namespace WebsitePanel.WebDav.Core
|
|||
private IHierarchyItem[] _children = new IHierarchyItem[0];
|
||||
private Uri _path;
|
||||
|
||||
public Uri Path { get { return _path; } }
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
|
@ -155,7 +160,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
var request = (HttpWebRequest) WebRequest.Create(_path);
|
||||
var request = (HttpWebRequest)WebRequest.Create(_path);
|
||||
request.PreAuthenticate = true;
|
||||
request.Method = "PROPFIND";
|
||||
request.ContentType = "application/xml";
|
||||
|
@ -163,10 +168,10 @@ namespace WebsitePanel.WebDav.Core
|
|||
//TODO Disable SSL
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||
|
||||
var credentials = (NetworkCredential) _credentials;
|
||||
var credentials = (NetworkCredential)_credentials;
|
||||
if (credentials != null && credentials.UserName != null)
|
||||
{
|
||||
request.Credentials = credentials;
|
||||
//request.Credentials = credentials;
|
||||
string auth = "Basic " +
|
||||
Convert.ToBase64String(
|
||||
Encoding.Default.GetBytes(credentials.UserName + ":" + credentials.Password));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue