Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Basically, Im not sure why this error request is coming up...

here is the bulk of the code.

It's saying the error on this line of code
C#
Customer customer = (context.Execute<Customer>(new Uri("GetAuthenticatedCustomer", UriKind.Relative), "POST", false, opParams)).FirstOrDefault();


Please shed some light! Thanks

C#
private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(emailAddressTextbox.Text) && !string.IsNullOrEmpty(passwordTextbox.Text))
            {
                Uri svcUri = new Uri("http://localhost:29875/iShop.svc");

                iShopEntities context = new iShopEntities(svcUri);

                UriOperationParameter[] opParams = new UriOperationParameter[2];

                opParams[0] = new UriOperationParameter("EmailAddress", emailAddressTextbox.Text);
                opParams[1] = new UriOperationParameter("Password", passwordTextbox.Text);

                Customer customer = (context.Execute<Customer>(new Uri("GetAuthenticatedCustomer", UriKind.Relative), "POST", false, opParams)).FirstOrDefault();
                Seller seller = (context.Execute<Seller>(new Uri("GetAuthenticatedSeller", UriKind.Relative), "POST", false, opParams)).FirstOrDefault();

                if (customer != null)
                {
                    MessageBox.Show("Welcome " + customer.FirstName);
                    //MainWindow mainWindow = new MainWindow();
                    //mainWindow.Show();

                    //CustomerOrder customerOrder = new CustomerOrder();
                    //customerOrder.customer = customer;
                    //customerOrder.Show();

                }
                else if (seller != null)
                {
                    MessageBox.Show("Welcome " + seller.FirstName);
                }
            }
            else
            {
                MessageBox.Show("Please specify email and password");
            }
        }
Posted
Comments
Andreas Gieriet 21-Apr-14 18:43pm    
What error?
Andi
[no name] 21-Apr-14 18:44pm    
That's the problem. It doesn't say what error. It literally say this : "An error occurred while processing this request" =/
[no name] 21-Apr-14 18:59pm    
Could be any number of reasons. See if http://blogs.msdn.com/b/phaniraj/archive/2008/06/18/debugging-ado-net-data-services.aspx helps
[no name] 21-Apr-14 19:09pm    
Nope that didnt't help one bit =/
ZurdoDev 21-Apr-14 20:19pm    
You may want to contact whoever wrote the webservice you are calling.

Also, refer to http://msdn.microsoft.com/en-us/library/cc646700(v=vs.113).aspx for different types of Exceptions that can be thrown. If you catch the specific exception you may get a lot more info.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900