Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 20th, 2008, 04:00 AM
Authorized User
 
Join Date: May 2008
Location: , , India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default v urgent..Error: not all code paths return a value

Hi..when i am trying to execute the code..its giving the following error:
'PublicServices.GetSignature(string, string)': not all code paths return a value.
the code is:

[WebMethod]
    public string GetSignature(string AccessKeyID, string content)
    {
        try
        {
            if (AuthorizeUser(AccessKeyID) == false)
            {
                return "";
            }
            Encoding myEncoding = new UTF8Encoding();
            // Create a new Cryptography class using the
            // Secret Access Key as the key
            HMACSHA1 myCrypto = new HMACSHA1(myEncoding.GetBytes(mySecretAccessKeyId)) ;
            // Calculate the digest
            byte[] strDigest = myCrypto.ComputeHash(Convert.FromBase64String(cont ent));
            return Convert.ToBase64String(strDigest);
        }
        catch (Exception ex)
        {
            sendException(ex);

        }
    }

public void sendException(Exception ex)
    {
       SendMail("ugsg@fgs.com", "xyz@abc.com", "errorhandling", "error occured" + ex.StackTrace + "\r\n" + "\r\n" + "error description :" + ex.Message.ToString() + "\r\n" + "\r\n" + "error generated time :" + System.DateTime.Now);
    }
public bool SendMail(string from, string to, string subject, string body)
    {
        try
        {
            SmtpClient mailObj = new SmtpClient();
            mailObj.Host = "mail.retgdsg.com";
            MailMessage msg = new MailMessage(from, to, subject, body);
            msg.IsBodyHtml = false;
            mailObj.Send(msg);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }

could any one help me...in this regard.

Reply With Quote
  #2 (permalink)  
Old May 20th, 2008, 06:17 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

The error means what it says - Not all code paths return a value.

If an exception is thrown inside the try/catch, then the execution will pass to the catch part of the code. From here to the end of the function there is no return statement. You either want to return null, or rethrow the exception.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
not all code paths return a value galua SQL Language 11 January 20th, 2008 09:36 PM
Urgent:hard disk serial code and vb code ivanlaw Pro VB 6 0 July 25th, 2007 04:05 AM
not all code paths return a value c# awaisfaisal C# 5 May 10th, 2007 08:02 AM
How to return "0" instead of #Error guizero Access 9 June 2nd, 2006 12:52 PM
Code to Remove Carriage Return From Spreadsheet Jersey Eric Excel VBA 2 May 12th, 2005 08:35 AM



All times are GMT -4. The time now is 09:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.