我需要为我的应用程序提供身份验证...并且使用email-id和密码我需要发布和放置数据..我是WP8的新手,所以任何人都可以告诉我如何提供认证..
当我点击login
按钮时..它应该从网址(服务器)验证电子邮件ID和密码,并应重定向到新页面。
我的XAML代码..
<TextBlock HorizontalAlignment="Left" Height="45" Margin="26,79,0,0" TextWrapping="Wrap" Text="E-Mail ID" VerticalAlignment="Top" Width="115"/>
<TextBlock HorizontalAlignment="Left" Height="45" Margin="26,159,0,0" TextWrapping="Wrap" Text="Password" VerticalAlignment="Top" Width="115"/>
<TextBox x:Name="txt_email" HorizontalAlignment="Left" Height="75" Margin="141,49,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="292" InputScope="EmailSmtpAddress"/>
<TextBox x:Name="txt_password" HorizontalAlignment="Left" Height="80" Margin="141,139,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="292" InputScope="Password"/>
<Button x:Name="btn_loin" Content="Log-In" HorizontalAlignment="Left" Height="80" VerticalAlignment="Top" Width="180" Click="btn_loin_click" Margin="141,254,0,0"/>
注册用户的以下代码工作正常...我需要使用注册用户执行下一个功能序列,如ADD /删除等。
我的注册btn_Click代码..
public void btn_register_click(object sender, RoutedEventArgs e)
{
register = populateRegisterDetails();
var objid = App.Current as App;
string registerDetails = GetJsonSerializeObject(register);
this.register = client.addNewRegistration(registerDetails);
NavigationService.Navigate(new Uri("/HomePage.xaml",UriKind.Relative));
}
通过静态传递电子邮件和密码,我的代码运作良好.....
//添加新组织..
public Organization addNewOrganization(string organizationDetails)
{
String email="far@c.com";
String password ="qq";
JsonClient client = new JsonClient();
string servicePath = ORGANIZATION_SERVICE + "?"+"email="+email+"&"+"sig="+password;
Organization organizationregisteredDetails = client.Post<Organization>(servicePath, organizationDetails);
return organizationregisteredDetails;
}
我的默认发布方法代码工作正常.....
public T Post<T>(string servicePath, string result)
{
string serviceURL = REST_URI + servicePath;
Uri URI = new Uri(serviceURL);
System.Net.WebClient webClient = new WebClient();
webClient.Headers["ContentType"] = "application/json";
webClient.Headers["Accept"] = "application/json";
webClient.UploadStringCompleted += this.sendPostCompleted;
webClient.UploadStringAsync(URI, HTTP_POST, result);
return default(T);
}
如果有人指导我,我会很有帮助。