when i use the codings i have an error like not all code path return a value.how can i solve this
public
string
try{
if
{
companymailid = mailname;
Session["cmailid"] = companymailid;
Server.Transfer(
}
{
companymailid = "";
}
}
else return companymailid;}"mail.aspx");(mailname != null)companymailid;string mailid(string mailname){
Manikavelu VelayuthamRank #413 · 6K reputationPosted Mar 2, 2011, 1:31 AM EST
Try like this
public string test(){
try
{
return "";
}
catch{
return "";
}
}
VulpesRank #55 · 29.2K reputationPosted Mar 2, 2011, 1:27 AM EST
karthi vimala38 reputationPosted Mar 2, 2011, 2:27 AM EST
i correct the previous error,by using session i pass the value to mail.aspx page when i execute this th error
Error executing child request for mail.aspx.
will occur,how can i solve this
here i attached my codings
Krishna GaradRank #191 · 12.8K reputationPosted Mar 2, 2011, 2:39 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Mar 2, 2011, 3:13 AM EST
karthi vimala38 reputationPosted Mar 2, 2011, 3:31 AM EST
ya,i specify false parameter in server.transfer("mail.aspx",false) and also for mail.aspx page i set enabledviewstate is false now also the same error will occur.
i didn't know why the error will occur.can anyone explain me why it will occur.
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Mar 2, 2011, 5:36 AM EST
Try this.
try
{
if(somecondition)
{
return something; //optional
}
else
{
return something; // optional
}
}
catch(Exception)
{
}
return something; //else error will raise.
the first two return statements are not considering in this case. because of its inside the if block.
Suthish NairRank #92 · 22.8K reputationPosted Mar 2, 2011, 7:56 AM EST