基本身份验证在Windows应用商店应用中使用webservice [英] Basic Authentication In windows Store app using webservice

查看:72
本文介绍了基本身份验证在Windows应用商店应用中使用webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi,
I am New to window Store app,
I have web service like below
public AuthHeader AuthHeaderValue;
[SoapHeader("AuthHeaderValue", Required = true)]
[WebMethod]
public bool Authentiction()
{
if (AuthHeaderValue.Username == "anji" && AuthHeaderValue.Password == "anji")
{
return true;
}
return false;
}
public class AuthHeader: SoapHeader
{
public string Username;
public string Password;

}
 ---------------------------------------------------------------------
 and My web service method soap requset like below ,
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header> <AuthHeader xmlns="http://tempuri.org/"> <Username>string</Username> <Password>string</Password>
</AuthHeader> </soap:Header>
<soap:Body> <Authentiction xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>

And I wanna pass values to Authheader
when add reference to my app,
It is not allowing me to pass values through webservice reference object.......................
ServiceReference1.AuthenticationSoapClient service = new ServiceReference1.AuthenticationSoapClient();
ServiceReference1.AuthHeader authentication = new ServiceReference1.AuthHeader();
authentication.Username = "anji";
authentication.Password = "anji";
service.AuthHeaderValue= authentication;

Is there any other way to pass Authheader value to my method.....
please provide the solution struggling with 3 days...Please Help.........................
Thanks,
Anji

推荐答案

这篇关于基本身份验证在Windows应用商店应用中使用webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆