1) Create this procedure or modify your SP accordingly
ALTER PROCEDURE GetURL
(@Username Nvarchar(50),@url NVARCHAR(MAX)= NULL OUTPUT)
AS
SELECT @url=
'http://api.thirdparty.com/http/sendmsg?user=' + username + '&password=' + password + '&api_id=' + api_id + '&to=081234567&text=Sending+http+from+sql'
FROM Userinfo WHERE username=@Username
select @url url
GO
2) Update your code to add this
SqlDataReader adm = null;
string outurl;
SqlConnection myConnection = new SqlConnection("Data Source=MDT765;Initial Catalog=TST;User Id=sa;Password=sa@123");
myConnection.Open();
SqlCommand cmd = new SqlCommand("GetURL", myConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(
new SqlParameter("@username", SqlDbType.NVarChar,50));
cmd.Parameters["@username"].Value = "user1";
SqlParameter url = new SqlParameter("@url", SqlDbType.NVarChar);
url.Direction = ParameterDirection.InputOutput;
url.Value = null;
url.Size = 255;
cmd.Parameters.Add(url);
adm = cmd.ExecuteReader();
if (adm.HasRows)
{
while (adm.Read())
{
outurl = adm["url"].ToString();
Response.Redirect(outurl);
}
}