Alexander Anikin's blog

My personal blog

Archive for February 2012

Making a Request to WebService in Visual Studio from Specific IP address

leave a comment »

Hey all  –

Task:

1. I have a web-service refference in my project. I update it time to time. It’s OK.

2. I have several network adapters in my system.

The main thing – I need to call a WebMethod refferenced in my project from specific IP.

Solution:

As you can see – VS generating class for Web Service Refference and it’s partial. So you can override  some very useful methods. In my case I should override GetWebRequest and change it’s properties. For changing EndPoint I should use ServicePoint.BindIPEndPointDelegate.

Example:


public IPEndPoint BindIpEndPointCallbackForIP(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount)
{
return new IPEndPoint(_currentLocalIp, 0);
}

protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = (HttpWebRequest) base.GetWebRequest(uri);
request.Timeout = 10000;
if (_currentLocalIp != null)
{
request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIpEndPointCallbackForIP);
}
return request;
}

I’m trying to make end-point (string in bold) with specific port (ex. 443 or 80), but it fails (why?). And in my case it doesn’t work with IPv6.

Written by Alex Anikin

February 13, 2012 at 2:50 pm

Posted in .Net, C#

Error Accessing SharePoint Document Library from Microsoft Office Open or Save As Dialog

leave a comment »

We got this issue from Windows Server 2008 from Citrix users. They tried to open or save document directly to SharePoint, but a dialog couldn’t browse into needed folder. And this works fine from Windows Server 2003.

Our server was in Trusted Sites with automatic login. The main problem was in WebDav client – it don’t get and use any browser sertting (so do nothing with Trusted Sites and so…)

Resolution for Windows Server 2008:

1. Need to install Desktop Experience with WebDav client and reboot server. (There was issues with Citrix after installation – need more investigation about.)

2. At AppServer need to add multiple-string key AuthForwardServerList to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters] and add all SP host-headers (like https://*.your-sharepoint.company.com)

 

Written by Alex Anikin

February 13, 2012 at 2:05 pm