My University grade card (result) is very complex to understand and It is very hard to calculate actual percentage of a student. So, I want to provide students a service where student will just need to enter there enrollment number. And I will calculate result my self.
Very firstly, I tried to send a post request to grade card page in http://hurl.it Here is the perm link http://hurl.it/hurls/c61f1d38b6543965151a1c8a8d6f641b8921da49/986ecba51b61022fa9fa162be612d7c928051989
But I am getting error when sending same request using jquery from my website: I am using following code to send request.
$.ajax({
type: "POST",
url: "http://stusupport12.ignou.ac.in/Result.asp",
data: "submit=Submit&eno=092853268&hidden%5Fsubmit=OK&Program=BCA",
success: function (d) {
$("#resultDiv").html(d);
},
error: function (a, b, c) { alert(a + b + c); }
});
Please help me friends.
Update 2 - I find my Solution by processing the request on my server. I'd created a Generic Handler (.ashx) that handles the request on server and send the processed request back to client. I can call it by Jquery.
Here is the code
<%@ WebHandler Language="C#" Class="IGNOU" %>
using System;
using System.Web;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Net;
using System.IO;
public class IGNOU : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
context.Response.Write(Func(context.Request.QueryString["eno"]));
}
public bool IsReusable {
get {
return false;
}
}
public string Func(string eno)
{
string str = string.Empty;
WebRequest request = WebRequest.Create("http://stusupport12.ignou.ac.in/Result.asp");
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "submit=Submit&Program=BCA&hidden_submit=OK&eno=" + eno;
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";
// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
// Get the request stream.
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
// Close the Stream object.
dataStream.Close();
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
// Display the content.
Console.WriteLine(responseFromServer);
// Clean up the streams.
reader.Close();
dataStream.Close();
response.Close();
return responseFromServer;
}
}
Update 1 Added link to web page https://www.bobdn.com/IGNOU_BCA_Result.aspx