I am working with WCF service to Insert, Select, & Update data to sql server DB tables.This service will be called from iPhone/Android app.
Whenever there is a decimals (.), Hash (#) and at the rate (@) symbol in URI, WCF stops working and give me server error?
Please help me out to resolve the issus.
Thanks in advance.
[EDIT - OPs code from comment]
public interface ICustomers
{
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat=WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "Register/{name}/{address}/{city}/{pincode}/{email}/{mobile}/{password}/{loggedvia}")]
string RegisterCustomer(string name, string address, string city, string pincode, string email, string mobile, string password, string loggedvia);
public string RegisterCustomer(string name, string address, string city, string pincode, string email, string mobile, string password, string loggedvia)
{
try
{
conRegisterCustomer = new SqlConnection(ConfigurationManager.AppSettings["Medico"]);
cmdRegisterCustomer = new SqlCommand("HMC_API_Insert_Customer", conRegisterCustomer);
conRegisterCustomer.Open();
cmdRegisterCustomer.CommandType = CommandType.StoredProcedure;
cmdRegisterCustomer.Parameters.AddWithValue("@Name", name);
cmdRegisterCustomer.Parameters.AddWithValue("@Address", address);
cmdRegisterCustomer.Parameters.AddWithValue("@City", city);
cmdRegisterCustomer.Parameters.AddWithValue("@PinCode", pincode);
cmdRegisterCustomer.Parameters.AddWithValue("@Email", email);
cmdRegisterCustomer.Parameters.AddWithValue("@Mobile", mobile);
cmdRegisterCustomer.Parameters.AddWithValue("@Password", password);
cmdRegisterCustomer.Parameters.AddWithValue("@LoggedVia", loggedvia);
cmdRegisterCustomer.Parameters.AddWithValue("@Createdate", System.DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"));
SqlParameter parmOUT = new SqlParameter("@CustId", SqlDbType.Int);
parmOUT.Direction = ParameterDirection.Output;
cmdRegisterCustomer.Parameters.Add(parmOUT);
cmdRegisterCustomer.ExecuteNonQuery();
rows = (int)cmdRegisterCustomer.Parameters["@CustId"].Value;
if (rows == 0)
{
return "fail";
}
else
{
return "success";
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
conRegisterCustomer.Close();
conRegisterCustomer.Dispose();
}
}
}