SQL Server - SSIS with Script task

Asked By Murugan V
28-Jan-10 02:06 AM
Hi All,
I have an issue while creating the webrequest.create(url) with the following scenario.

I have deployed the Reports in the report server.
I have created SSIS package which has the script task.
Script task is used for generating the reports and export it to PDF format and stored it in the shared (configured) location.
I have written the VB.NET code to read the report server & report name URL.
When i tried to access the URL through VB.NET code, i'm getting the exception like below

"System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()"

If anyone come across this situation and resolved, please share your thoughts.

Thanks in Advance.
  nanda Kishore replied to Murugan V
02-Apr-10 05:22 AM
Try below code

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://Jupiter:8080/Reportserver"); 
request.MaximumAutomaticRedirections = 4;
request.MaximumResponseHeadersLength = 4;

request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Response.Write("Content length is:"+response.ContentLength);
Response.Write("Content type is: "+response.ContentType);
          
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream,System.Text.Encoding.UTF8);                        
Response.Write(readStream.ReadToEnd());
response.Close();
readStream.Close();
Create New Account
help
document public void connect() { ckuser = Session[ "id" ].ToString(); ckpass = Session[ "pw" ].ToString(); try { this .req = (HttpWebRequest)WebRequest.Create( "http: / / wwwd.way2sms.com / auth.cl" ); this .req.CookieContainer = new CookieContainer(); this .req new StreamWriter( this .req.GetRequestStream(), Encoding.ASCII); writer.Write( this .strNewValue); writer.Close(); this .response = (HttpWebResponse) this .req.GetResponse(); this .cookieCntr = this .req.CookieContainer; this .response.Close(); this .req = (HttpWebRequest)WebRequest.Create( "http: / / wwwd.way2sms.com / / jsp / InstantSMS.jsp?val = 0" ); this .req.CookieContainer = this cookieCntr; this .req.Method = "GET" ; this .response = (HttpWebResponse) this .req.GetResponse(); responseee = new StreamReader( this .response.GetResponseStream()).ReadToEnd(); int index = Regex.Match(responseee, "custf" ).Index; responseee = responseee.Substring(index, 0x12); responseee = responseee Replace( "> " , "" ).Trim(); this .response.Close(); pnlsend.Visible = true ; lblErrormsg.Text = "connected" ; } catch (Exception) { lblErrormsg.Text = "Error connecting to the server. . ." ; Session[ "error" ] = "Error connecting to the server. . ." ; Server.Transfer( "smslogin.aspx" ); } } public void sendSms( string mbno, string
as ASP.NET. If the session state is stored in a common format in Microsoft® SQL Server, the session state can be accessible by both classic ASP and ASP.NET. In this the session. On subsequent request, the browser will send the unique cookie back to the server to identify the session. Before the requested Web page is loaded, a custom object will reload the user session data from SQL Server using the unique cookie. The session state is accessible in the Web page through the After the Web request is finished, the session data will be persisted back to the SQL Server as the request terminates As you migrate your Web apps from classic ASP to ASP of an application can be migrated to ASP.NET pages. Finally, it should require minimal server-based components beyond ASP.NET and ASP-based pages (or better yet, none at all
sender, EventArgs e) { try { / / Create the request and send data to Ozeki NG SMS Gateway Server by HTTP connection HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL); / / Get response from Ozeki NG SMS Gateway Server and read the answer HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse(); System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp GetResponseStream()); string responseString = respStreamReader.ReadToEnd(); respStreamReader.Close(); myResp.Close(); / / inform the user textboxError.Text = responseString; textboxError catch (Exception) { / / if sending request or getting response is not successful, Ozeki NG - SMS Gateway Server may not be running textboxError.Text = "Ozeki NG SMS Gateway Server is not running!"; textboxError
tional.dtd "> <html xmlns = " http: / / www.w3.org / 1 999 / xhtml " > <head id = "Head1" runat = "server"> <title> Untitled Page< / title> < / head> <body> < / body> < / html> using System; using System.Xml; using System.IO; using System.Net; using System.Configuration; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Xml.Schema; using System.Xml.XPath; using System.Net Read(B , 0, B.Length); FormData = System.Text.ASCIIEncoding. ASCII.GetS tring(B); / / Check Request Server Variables if (Request.ServerVariables[" REQUEST_ME THOD"].ToU pper() ! = "POST") RETURN_CODE = (int)ResponseCodes.Invalid RequestMet hod xhtml1-transitional.dtd"> < html xmlns = "http: / / www.w3.org / 1999 / xhtml" > < head id = "Head1" runat = "server"> < title > Untitled Page < / title > < / head > < body > < form id = "form1" runat = "server"> < div > < / div > < / form > < / body > < / html > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = using System; using System.Xml; using System.IO; using System Net; using System.Configuration; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Xml.Schema; using System.Xml.XPath; using System.Net InputStream.Read(B, 0, B.Length); FormData = System.Text. ASCIIEncoding .ASCII.GetString(B); / / Check Request Server Variables if (Request.ServerVariables[ "REQUEST_METHOD" ].ToUpper() ! = "POST" ) RETURN_CODE = ( int ) ResponseCodes .InvalidRequestMethod; / / if not invalid request ui do i need autoeventwireup to false and do I need a form <form runat = "server" . . .> < / form> not sure how to setup the page so the data will be receive through
Visible = true ; lblMessage.Text = " Message Send Succesfully" ; } catch (Exception ex) { lblMessage.Visible = true ; lblMessage.Text = " Error in Sending message" +ex.ToString(); } } private void rdoType_SelectedIndexChanged( object sender, System.EventArgs e) { if (rdoType are familiar with Visual Studio 2003 or 2005 and the basics of databases and the SQL language. The solution described here is an in-house solution. To use it, you need GSM Modem, that is attached to the PC with a phone-to-PC datacable, an SQL-SMS Gateway software installed onto your PC, an SQL database server, such as SQL Express or Microsoft SQL and your SMS application (Figure 1). As you can see in the figure, your SMS application will create an SQL record in the database. The SMS gateway will poll this record using an SQL SELECT