Search This Blog

Thursday, December 16, 2010

WebRequest for sending SMS By GET METHOD

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Web.Security;
using System.Web.UI.HtmlControls;


public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SendSms();

}
protected void SendSms()
{
try
{

string userid1 = "test&";
string pass1 = "test&";
string appid1 = "test&";
string subappid1 = "test&";
string contenttype1 = "1&";
string selfid1 = "true&";
string from1 = "test&";
string to1 = "9911964567&";
string text1 = "thanks for visit our site&";
string dlrreq1 = "true&";
string alert1 = "1";
string url = "http://sms gateway url?";
string str_request = "userId=" + userid1 + "pass=" + pass1 + "appid=" + appid1 + "subappid=" + subappid1 + "contenttype=" + contenttype1 + "selfid=" + selfid1 + "from=" + from1 + "to=" + to1 + "text=" + text1 + "dlrreq=" + dlrreq1 + "alert=" + alert1;
WebRequest request = WebRequest.Create(url + str_request);
request.Method = "GET";
request.ContentLength=str_request.Length;
request.ContentType="application/x-www-form-urlencoded";
using (WebResponse response = request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
StreamReader sr = new StreamReader(stream);


}

}

HttpWebRequest for sms sending by post method

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Web.Security;
using System.Web.UI.HtmlControls;


public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SendSms();

}
protected void SendSms()
{
try
{

string userid1 = "test&";
string pass1 = "test&";
string appid1 = "test&";
string subappid1 = "test&";
string contenttype1 = "1&";
string selfid1 = "true&";
string from1 = "test&";
string to1 = "9994567831&";
string text1 = "thanks for visit our site&";
string dlrreq1 = "true&";
string alert1 = "1";
string url = "http://smsgateway api url?";
string str_request = "userId=" + userid1 + "pass=" + pass1 + "appid=" + appid1 + "subappid=" + subappid1 + "contenttype=" + contenttype1 + "selfid=" + selfid1 + "from=" + from1 + "to=" + to1 + "text=" + text1 + "dlrreq=" + dlrreq1 + "alert=" + alert1;
string from_sms = "";

StreamWriter sms_writer = null;
HttpWebRequest obj_request = (HttpWebRequest)WebRequest.Create(url + str_request);
obj_request.Method = "post";
obj_request.ContentLength = str_request.Length;
obj_request.ContentType = "application/x-www-form-urlencoded";
sms_writer = new StreamWriter(obj_request.GetRequestStream());
sms_writer.Write(str_request);
sms_writer.Close();
HttpWebResponse obj_response = (HttpWebResponse)obj_request.GetResponse();
using (StreamReader sr = new StreamReader(obj_response.GetResponseStream()))
{
from_sms = sr.ReadToEnd();
sr.Close();
}
}
catch (Exception ex)
{

string str = ex.Message;
lab_mesg.Text = str;
}
}
}

Friday, December 3, 2010

How can set identity in table column SQL2008 when data exist in table

Set identity in SQL2008 table column when data exist in table.
1.export data from local server to other server.
2.when select table from one server to other server.
3.Edit mapping option in window.
4.Click this button open window have option Edit SQL.
5.Click EDit SQLand change shema of table and then ok.
6.befor this select enable identity insert/Drop recreate option also.