Using XmlUriResolver to provide credentials to remote share
up vote
0
down vote
favorite
Thank you in advance for any and all help.
I have seen several post on Stack Overflow and other sites on the net (including Microsoft Docs), but none seeming to help resolve my issue.
I am working on a project that connects to a xml file on a remote file share from WinPE. I have used suggestions from another post on SO about using the XmlUriResolver class to "moderate" success.
The issue I am currently being faced with is either a "Access Denied" error (several attempts to modify the XmlUriResolver.Credentials class) or a complete failure without any reason for failure. I am assuming it is going to be another "Access Denied" error, but my try/catch (Exception e) isn't capturing the reason.
Below is a snippet and relevant part of the method I am trying to implement:
relativeSysData = relativeSysData.Replace(@"", "/");
SysdataXml = $"file://_globaldata.Server/_globaldata.Share/relativeSysData";
XmlUrlResolver XmlResolver = new XmlUrlResolver();
XmlResolver.Credentials = new NetworkCredential(_UserName,
_Password);
XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.XmlResolver = XmlResolver;
LogWriter.WriteLogFile((int)LogWriter.EventID.Xml, (int)LogWriter.EventType.Info,
$"Connecting to (remote) System information store at: SysdataXml");
xDoc = XDocument.Load(XmlReader.Create(SysdataXml, xmlSettings));
if (xDoc == null)
LogWriter.WriteLogFile((int)LogWriter.EventID.XmlError, (int)LogWriter.EventType.Error,
$"Unable to connect to the (remote) data store located at: SysdataXml");
deploy = false;
capture = false;
return result;
This part of the method is specific to accessing the remote data. I have a try/catch statement encompassing all of the method.
If I have an open connection to the Network Share, the method will work flawlessly, but will cause the application this application starts to fail - due to an open connection already.
I have a possible alternative to work round this solution but will cost extra lines of code.
Any help in resolving this matter, without resorting to WNetAddConnection() will be gratefully received
Kind Regards
Richie
N.B. I am aware that this is an authentication issue.
c# xml winpe
|
show 12 more comments
up vote
0
down vote
favorite
Thank you in advance for any and all help.
I have seen several post on Stack Overflow and other sites on the net (including Microsoft Docs), but none seeming to help resolve my issue.
I am working on a project that connects to a xml file on a remote file share from WinPE. I have used suggestions from another post on SO about using the XmlUriResolver class to "moderate" success.
The issue I am currently being faced with is either a "Access Denied" error (several attempts to modify the XmlUriResolver.Credentials class) or a complete failure without any reason for failure. I am assuming it is going to be another "Access Denied" error, but my try/catch (Exception e) isn't capturing the reason.
Below is a snippet and relevant part of the method I am trying to implement:
relativeSysData = relativeSysData.Replace(@"", "/");
SysdataXml = $"file://_globaldata.Server/_globaldata.Share/relativeSysData";
XmlUrlResolver XmlResolver = new XmlUrlResolver();
XmlResolver.Credentials = new NetworkCredential(_UserName,
_Password);
XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.XmlResolver = XmlResolver;
LogWriter.WriteLogFile((int)LogWriter.EventID.Xml, (int)LogWriter.EventType.Info,
$"Connecting to (remote) System information store at: SysdataXml");
xDoc = XDocument.Load(XmlReader.Create(SysdataXml, xmlSettings));
if (xDoc == null)
LogWriter.WriteLogFile((int)LogWriter.EventID.XmlError, (int)LogWriter.EventType.Error,
$"Unable to connect to the (remote) data store located at: SysdataXml");
deploy = false;
capture = false;
return result;
This part of the method is specific to accessing the remote data. I have a try/catch statement encompassing all of the method.
If I have an open connection to the Network Share, the method will work flawlessly, but will cause the application this application starts to fail - due to an open connection already.
I have a possible alternative to work round this solution but will cost extra lines of code.
Any help in resolving this matter, without resorting to WNetAddConnection() will be gratefully received
Kind Regards
Richie
N.B. I am aware that this is an authentication issue.
c# xml winpe
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21
|
show 12 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Thank you in advance for any and all help.
I have seen several post on Stack Overflow and other sites on the net (including Microsoft Docs), but none seeming to help resolve my issue.
I am working on a project that connects to a xml file on a remote file share from WinPE. I have used suggestions from another post on SO about using the XmlUriResolver class to "moderate" success.
The issue I am currently being faced with is either a "Access Denied" error (several attempts to modify the XmlUriResolver.Credentials class) or a complete failure without any reason for failure. I am assuming it is going to be another "Access Denied" error, but my try/catch (Exception e) isn't capturing the reason.
Below is a snippet and relevant part of the method I am trying to implement:
relativeSysData = relativeSysData.Replace(@"", "/");
SysdataXml = $"file://_globaldata.Server/_globaldata.Share/relativeSysData";
XmlUrlResolver XmlResolver = new XmlUrlResolver();
XmlResolver.Credentials = new NetworkCredential(_UserName,
_Password);
XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.XmlResolver = XmlResolver;
LogWriter.WriteLogFile((int)LogWriter.EventID.Xml, (int)LogWriter.EventType.Info,
$"Connecting to (remote) System information store at: SysdataXml");
xDoc = XDocument.Load(XmlReader.Create(SysdataXml, xmlSettings));
if (xDoc == null)
LogWriter.WriteLogFile((int)LogWriter.EventID.XmlError, (int)LogWriter.EventType.Error,
$"Unable to connect to the (remote) data store located at: SysdataXml");
deploy = false;
capture = false;
return result;
This part of the method is specific to accessing the remote data. I have a try/catch statement encompassing all of the method.
If I have an open connection to the Network Share, the method will work flawlessly, but will cause the application this application starts to fail - due to an open connection already.
I have a possible alternative to work round this solution but will cost extra lines of code.
Any help in resolving this matter, without resorting to WNetAddConnection() will be gratefully received
Kind Regards
Richie
N.B. I am aware that this is an authentication issue.
c# xml winpe
Thank you in advance for any and all help.
I have seen several post on Stack Overflow and other sites on the net (including Microsoft Docs), but none seeming to help resolve my issue.
I am working on a project that connects to a xml file on a remote file share from WinPE. I have used suggestions from another post on SO about using the XmlUriResolver class to "moderate" success.
The issue I am currently being faced with is either a "Access Denied" error (several attempts to modify the XmlUriResolver.Credentials class) or a complete failure without any reason for failure. I am assuming it is going to be another "Access Denied" error, but my try/catch (Exception e) isn't capturing the reason.
Below is a snippet and relevant part of the method I am trying to implement:
relativeSysData = relativeSysData.Replace(@"", "/");
SysdataXml = $"file://_globaldata.Server/_globaldata.Share/relativeSysData";
XmlUrlResolver XmlResolver = new XmlUrlResolver();
XmlResolver.Credentials = new NetworkCredential(_UserName,
_Password);
XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.XmlResolver = XmlResolver;
LogWriter.WriteLogFile((int)LogWriter.EventID.Xml, (int)LogWriter.EventType.Info,
$"Connecting to (remote) System information store at: SysdataXml");
xDoc = XDocument.Load(XmlReader.Create(SysdataXml, xmlSettings));
if (xDoc == null)
LogWriter.WriteLogFile((int)LogWriter.EventID.XmlError, (int)LogWriter.EventType.Error,
$"Unable to connect to the (remote) data store located at: SysdataXml");
deploy = false;
capture = false;
return result;
This part of the method is specific to accessing the remote data. I have a try/catch statement encompassing all of the method.
If I have an open connection to the Network Share, the method will work flawlessly, but will cause the application this application starts to fail - due to an open connection already.
I have a possible alternative to work round this solution but will cost extra lines of code.
Any help in resolving this matter, without resorting to WNetAddConnection() will be gratefully received
Kind Regards
Richie
N.B. I am aware that this is an authentication issue.
c# xml winpe
c# xml winpe
edited Nov 10 at 21:25
asked Nov 10 at 20:40
R.McInnes-Piper
105
105
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21
|
show 12 more comments
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21
|
show 12 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
After research into how the XmlUrlResolver class works, I think that it may be referencing/accessing API's that are not included within the WinPE API framework.
After testing, I have used the WNetAddConnection2() API to connect to the Server and authenticate before anything happens, ensuring that the local name of the NETRESOURCE structure is left null, and that DisplayType is set to Server.
public static int ConnectToServer()
(int)_ConnectionType.Temporary;
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Attempting to connect to: \_netresource.RemoteName");
result = WNetAddConnection2(_netresource, _passsword, _username, _connectiontype);
var res = Marshal.GetLastWin32Error();
if (result !=0)
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Error,
$@"Failed to connect to: \_netresource.RemoteName, Return Result: result.ToString(), Win32 Error Code: res.ToString()");
result = res;
else
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Connection to: \_netresource.RemoteName has been successfull.");
return result;
[DllImport("mpr.dll", SetLastError = true)]
private static extern int WNetAddConnection2(NetResource netResource, string password, string username, int flags);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243202%2fusing-xmluriresolver-to-provide-credentials-to-remote-share%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
After research into how the XmlUrlResolver class works, I think that it may be referencing/accessing API's that are not included within the WinPE API framework.
After testing, I have used the WNetAddConnection2() API to connect to the Server and authenticate before anything happens, ensuring that the local name of the NETRESOURCE structure is left null, and that DisplayType is set to Server.
public static int ConnectToServer()
(int)_ConnectionType.Temporary;
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Attempting to connect to: \_netresource.RemoteName");
result = WNetAddConnection2(_netresource, _passsword, _username, _connectiontype);
var res = Marshal.GetLastWin32Error();
if (result !=0)
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Error,
$@"Failed to connect to: \_netresource.RemoteName, Return Result: result.ToString(), Win32 Error Code: res.ToString()");
result = res;
else
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Connection to: \_netresource.RemoteName has been successfull.");
return result;
[DllImport("mpr.dll", SetLastError = true)]
private static extern int WNetAddConnection2(NetResource netResource, string password, string username, int flags);
add a comment |
up vote
0
down vote
accepted
After research into how the XmlUrlResolver class works, I think that it may be referencing/accessing API's that are not included within the WinPE API framework.
After testing, I have used the WNetAddConnection2() API to connect to the Server and authenticate before anything happens, ensuring that the local name of the NETRESOURCE structure is left null, and that DisplayType is set to Server.
public static int ConnectToServer()
(int)_ConnectionType.Temporary;
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Attempting to connect to: \_netresource.RemoteName");
result = WNetAddConnection2(_netresource, _passsword, _username, _connectiontype);
var res = Marshal.GetLastWin32Error();
if (result !=0)
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Error,
$@"Failed to connect to: \_netresource.RemoteName, Return Result: result.ToString(), Win32 Error Code: res.ToString()");
result = res;
else
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Connection to: \_netresource.RemoteName has been successfull.");
return result;
[DllImport("mpr.dll", SetLastError = true)]
private static extern int WNetAddConnection2(NetResource netResource, string password, string username, int flags);
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
After research into how the XmlUrlResolver class works, I think that it may be referencing/accessing API's that are not included within the WinPE API framework.
After testing, I have used the WNetAddConnection2() API to connect to the Server and authenticate before anything happens, ensuring that the local name of the NETRESOURCE structure is left null, and that DisplayType is set to Server.
public static int ConnectToServer()
(int)_ConnectionType.Temporary;
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Attempting to connect to: \_netresource.RemoteName");
result = WNetAddConnection2(_netresource, _passsword, _username, _connectiontype);
var res = Marshal.GetLastWin32Error();
if (result !=0)
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Error,
$@"Failed to connect to: \_netresource.RemoteName, Return Result: result.ToString(), Win32 Error Code: res.ToString()");
result = res;
else
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Connection to: \_netresource.RemoteName has been successfull.");
return result;
[DllImport("mpr.dll", SetLastError = true)]
private static extern int WNetAddConnection2(NetResource netResource, string password, string username, int flags);
After research into how the XmlUrlResolver class works, I think that it may be referencing/accessing API's that are not included within the WinPE API framework.
After testing, I have used the WNetAddConnection2() API to connect to the Server and authenticate before anything happens, ensuring that the local name of the NETRESOURCE structure is left null, and that DisplayType is set to Server.
public static int ConnectToServer()
(int)_ConnectionType.Temporary;
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Attempting to connect to: \_netresource.RemoteName");
result = WNetAddConnection2(_netresource, _passsword, _username, _connectiontype);
var res = Marshal.GetLastWin32Error();
if (result !=0)
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Error,
$@"Failed to connect to: \_netresource.RemoteName, Return Result: result.ToString(), Win32 Error Code: res.ToString()");
result = res;
else
LogWriter.WriteLogFile((int)LogWriter.EventID.NetMan, (int)LogWriter.EventType.Info,
$@"Connection to: \_netresource.RemoteName has been successfull.");
return result;
[DllImport("mpr.dll", SetLastError = true)]
private static extern int WNetAddConnection2(NetResource netResource, string password, string username, int flags);
answered Nov 11 at 19:53
R.McInnes-Piper
105
105
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243202%2fusing-xmluriresolver-to-provide-credentials-to-remote-share%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if (xDoc == null) has been modified to if (string.IsEmptyorNull(xDoc..ToString()))
– R.McInnes-Piper
Nov 10 at 20:42
With Windows never use a username and password to access a shared folder. It will not work. Use default credential if you have access to the driver using an explorer : XmlResolver.Credentials = System.Net.CredentialCache.DefaultCredentials; or XmlResolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
– jdweng
Nov 10 at 20:55
Default credentials will not work. I'm operating from WinPe (Win 10 ver 1809). The credentials are "User" and without building my own file explorer (or using a third party design for WinPE). I can connect using WNetAddConnection(), but would rather not, as the implications of it failing to close the connection will fail the entire remote build.
– R.McInnes-Piper
Nov 10 at 21:02
Can you access the shared drive using a Window Explorer? Windows doesn't allow remote connections without a Group setup to allow a connection from another PC.
– jdweng
Nov 10 at 21:12
I'm programming for Windows Pre-Installation Environment (WinPE), there are no Explorers, whether Windows or Internet - the application works a dream in the full version of Windows, but is failing in the mini-os that WinPE is. The Remote computer is setup to allow remote connections. The Application that this one starts relies upon WNetAddConnection to transfer 4GB+ file sizes. That is why I would like to utilise a method like this to connect to the UNC file path. My apologies - I may not have explained it fully in my question post.
– R.McInnes-Piper
Nov 10 at 21:21