Search This Blog
Friday, December 16, 2011
How can check in SQL 2008 which query execute in sql
SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
Tuesday, December 6, 2011
global.asax works on local computer but not after i publish to server
instead of the Application_Start because the first request might be local but later you could call the application on some other domain and it will no longer be local.
Local system code:
protected void Application_Start(object sender, EventArgs e)
{
Application["Visitors"] = 0;
// Code that runs on application startup
}
On Server Code:
protected void Application_OnStart(object sender, EventArgs e)
{
Application["Visitors"] = 0;
// Code that runs on application startup
}
Local system code:
protected void Application_Start(object sender, EventArgs e)
{
Application["Visitors"] = 0;
// Code that runs on application startup
}
On Server Code:
protected void Application_OnStart(object sender, EventArgs e)
{
Application["Visitors"] = 0;
// Code that runs on application startup
}
How can implement Restful API
Restful Web Service:
Case 1: It is not work on Add reference process
Case 2: It is not use soap protocol
Case 3: It is Call by HttpWebRequest HttpWebResponse
Case4: In this case get post method are use for getting response and request.
The Methods
Case 2: It is not use soap protocol
Case 3: It is Call by HttpWebRequest HttpWebResponse
Case4: In this case get post method are use for getting response and request.
The Methods
The interface of REST is generic. There is no need for protocol conventions for the communication between client and server. The following list describes the meaning of the HTTP methods and how they are used by REST.
Table 1: HTTP Methods | |
Method | Description |
GET | GET queries the representation of a resource. The execution of requests should be free from side effects. GET requests can be sent arbitrarily often. You cannot blame the client for effects caused by GET requests. That means a GET can be sent heedlessly. |
POST | With POST you can change the state of a resource. For example you can add a good to a shopping cart. POST isn't free from side effects. For example you can change fields in a data base or start a new process on the server with a POST request. |
PUT | New resources can be produced with PUT or you can replace the content of existing resources. |
DELETE | Resources can be deleted using DELETE. |
How to call:
Case: 1 First Request Format
1: text
2: Xml
3: html
2: Xml
3: html
Case 2: Check your query string name for send request or any variable name
Case 3: url of rest web service
Method: For Xml Format
private string PostData_new(string url, string postData)
{
HttpWebRequest request = null;
Uri uri = new Uri(url);
request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.Length;
using (Stream writeStream = request.GetRequestStream())
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(postData);
writeStream.Write(bytes, 0, bytes.Length);
}
string result = string.Empty;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8))
{
result = readStream.ReadToEnd();
}
}
}
return result;
}
Call function:
Postdate=”variable name/Query string name=your date”
Subscribe to:
Posts
(
Atom
)