MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A deployed web aspx page does not display response over the

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp
Author Message
chike_oji



Joined: 13 Dec 2007
Posts: 10

PostPosted: Fri Feb 22, 2008 1:30 pm    Post subject: A deployed web aspx page does not display response over the Reply with quote

Hello all,

please I need help with an a web app that I
am developing. I am using .NET 2.0, VS 2005, IIS 6.0, Windows Server
2003 Standard Edition sp2
The application was deployed our server in my country
and it was accessible over the internet from our clients.

Later due to QOS issues, we decided to host the app
on our dedicated server in the UK.

I re-deployed the app on the server via remote access means and
tested it out on the local machine using the hostname "localhost".
It worked but anytime I try to access it from over the internet from
another machine in
a different geographical location, the default.aspx page works,
displaying its content but the
main page (waspprovider.aspx) that sends data from the database as a
HttpResponse object,
doesn't display anything but the page gets hit.

The contents of the working Default.aspx page is as follows:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Untitled Page




Welcome to Visafone web content provision web application. div>




The content of the waspprovider.aspx.cs page is as follows:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System .Collections.Generic ;
using System.Data.SqlClient;

using A3MessageProcessing;
using A3MessageTransaction;

//using Guinnesspromo;

public partial class Rawurl : System.Web.UI.Page
{
private string _shortcode =
System.Configuration.ConfigurationManager.AppSettings["shortcode"],
_username =
System.Configuration.ConfigurationManager.AppSettings["username"] ,
_password =
System.Configuration.ConfigurationManager.AppSettings["password"],
_port =
System.Configuration.ConfigurationManager.AppSettings["port"],

servicename = null ;

public string shortcode
{
get { return _shortcode; }

}

public string username
{
get { return _username; }

}

public string password
{
get { return _password; }

}

public string port
{
get { return _port; }

}

string responseString = null ;

protected void Page_Load(object sender, EventArgs e)
{

try
{
Page.Title = "";
TransactionInfo tif = new TransactionInfo();
responseString = "Thank you... [Iconcepts TECH.]";

//if (Page.Request.RawUrl.Contains("sms_src_addr=") &&
Page.Request.RawUrl.Contains("sms_dest_addr=") &&
Page.Request.RawUrl.Contains("sms_text="))
if (Page.Request.RawUrl.Contains("sms_src_addr=") &&
Page.Request.RawUrl.Contains("sms_text="))
{
NameValueCollection queryString =
Page.Request.QueryString;

// from here ...
if (Page.Request.RawUrl.Contains("username="+username ) &&
Page.Request.RawUrl.Contains("password="+password))
{
//string gsm = getQueryStringValue("sms_dest_addr",
queryString).Trim();
string gsm = "xxxxx;//Hard code the sms_dest_addr
specifically for visafone/UCIas they requested not to see that
querystring.

if (gsm == shortcode)
{

// Correct format analysis
tif.m_shortCode = gsm;
tif.m_msisdn = getQueryStringValue("sms_src_addr",
queryString);
//tif.m_destAddressIn =
getQueryStringValue("sms_dest_addr", queryString);
tif.m_destAddressIn = gsm;
tif.m_bodyIn = getQueryStringValue("sms_text",
queryString);
string mid = getQueryStringValue("sms_id",
queryString);
tif.m_dateIn = DateTime.Now.ToString("dd-MM-yyyy
HH:mm:ss");
//tif.m_destAddressIn = gsm; This line is a
repetition and duplication of effort. Consider deleting this line.
//bool toGlo = SendGLOMessage(tif, mid, out
responseString);
tif.m_operatorID = OperatorID.Globacom;//This was
left till the creation of a Visafone element in the Enum. Doesn't
cause any problems.

try
{
TransactionInfoProcessor smsobject = null;
smsobject = new Iconceptservices();
if (smsobject != null)
smsobject.processTransactionInfo(tif);
// tif.m_bodyOut = "Thank you for
playing ...";

bool bl = LogToDatabase(tif);

}
catch (Exception er)
{

}

responseString = tif.m_bodyOut;

}

else
{
responseString = "Invalid Login Credentials! [" +
DateTime.Now.ToString() + "Iconcepts";

}
}
else
{
responseString = "Wrong msg format. Port is still
alive! [" + DateTime.Now.ToString() + "Iconcepts";

}
}

//Make sure the response string length is not greater than
160.
if (responseString.Length > 160)
{
responseString = responseString.Substring(0,
160);
}
//Trying to implement

// Obtain a response object
HttpResponse httpresponse = Page.Response;
byte[] buffer = Encoding.UTF8.GetBytes(responseString);

// Get a response stream and write the response to it
// httpresponse.ContentLength64 = buffer.Length;
httpresponse.ContentType = "text/plain";
//Trying to implement returning error 404 if there is no
content
if (responseString.StartsWith("no content for the day"))
{
httpresponse.StatusCode = 404; httpresponse.Status =
"404 Not Found";
httpresponse.OutputStream.Write(buffer, 0,
buffer.Length);
httpresponse.Flush(); httpresponse.Close();
}
else//everything is ok here.i.e content is returned and
client billed.
{
httpresponse.OutputStream.Write(buffer, 0,
buffer.Length);
httpresponse.Flush(); httpresponse.Close();
}

}
catch (Exception exception)
{
//Console.WriteLine(exception.Message);
//Console.WriteLine(exception.StackTrace);
}

finally
{
// do neccessary task here ...
}

return;

}

private static String getQueryStringValue(String keyName,
NameValueCollection queryString)

{

String keyValue = null;

// Get each header and display each value
foreach (String key in queryString.AllKeys)
{
if (keyName.ToLower().CompareTo(key.ToLower()) == 0)
{
keyValue = queryString[key];
}
}

return keyValue;
}

// logging sms messages to mg_transaction_log for persistent
reference ...
private static bool LogToDatabase(TransactionInfo tif)
{
Dictionary dictionary = new
Dictionary();
Procedure_Values procedure = null;
procedure = new Procedure_Values();

SqlParameter operatorID = null;
procedure.pname = "operatorID";
procedure.sqlparameter = operatorID;
procedure.sqldbtype = SqlDbType.VarChar;
procedure.svalue = "VISAFONE";

procedure.size = 25;
procedure.direction = ParameterDirection.Input;
dictionary.Add(procedure.pname, procedure);

procedure = new Procedure_Values();
SqlParameter msisdn = null;
procedure.pname = "msisdn";
procedure.sqlparameter = msisdn;
procedure.sqldbtype = SqlDbType.VarChar;
procedure.svalue = tif.m_msisdn;
procedure.size = 15;
procedure.direction = ParameterDirection.Input;
dictionary.Add(procedure.pname, procedure);

procedure = new Procedure_Values();
SqlParameter shortcode = null;
procedure.pname = "shortcode";
procedure.sqlparameter = shortcode;
procedure.sqldbtype = SqlDbType.VarChar;
procedure.svalue = tif.m_shortCode;
procedure.size = 50;
procedure.direction = ParameterDirection.Input;
dictionary.Add(procedure.pname, procedure);

procedure = new Procedure_Values();
SqlParameter servicename = null;
procedure.pname = "servicename";
procedure.sqlparameter = servicename;
procedure.sqldbtype = SqlDbType.VarChar;
procedure.svalue = tif.m_idOut;
procedure.size = 15;
procedure.direction = ParameterDirection.Input;
dictionary.Add(procedure.pname, procedure);

procedure = new Procedure_Values();
SqlParameter log_date = null;
procedure.pname = "log_date";
procedure.sqlparameter = log_date;
procedure.sqldbtype = SqlDbType.DateTime;
procedure.dvalue = DateTime.Now;
procedure.direction = ParameterDirection.Input;
dictionary.Add(procedure.pname, procedure);

procedure = new Procedure_Values();
SqlParameter message_body_in = null;
procedure.pname = "message_body_in";

I wanted to add that the OS on the UK server is
Microsoft Server 2003 Standard edition Service Pack 2
and it has IIS 6.0 webserver running on it.

Thanks in anticipation of your response.

Regards,

Chike

Archived from group: microsoft>public>dotnet>languages>csharp
Back to top
View user's profile Send private message
Peter Bromberg [C# MVP]



Joined: 31 Oct 2007
Posts: 22

PostPosted: Fri Feb 22, 2008 2:16 pm    Post subject: RE: A deployed web aspx page does not display response over Reply with quote

Chike,
the ASP.NET group would be a more appropriate place to post your question.
This is the C# language group. Also, writing exception information to the
Console isn't going to help much in an ASP.NET web application!
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: htp://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"chike_oji@yahoo.com" wrote:

> Hello all,
>
> please I need help with an a web app that I
> am developing. I am using .NET 2.0, VS 2005, IIS 6.0, Windows Server
> 2003 Standard Edition sp2
> The application was deployed our server in my country
> and it was accessible over the internet from our clients.
>
> Later due to QOS issues, we decided to host the app
> on our dedicated server in the UK.
>
> I re-deployed the app on the server via remote access means and
> tested it out on the local machine using the hostname "localhost".
> It worked but anytime I try to access it from over the internet from
> another machine in
> a different geographical location, the default.aspx page works,
> displaying its content but the
> main page (waspprovider.aspx) that sends data from the database as a
> HttpResponse object,
> doesn't display anything but the page gets hit.
>
> The contents of the working Default.aspx page is as follows:
>
> <%@ Page Language="C#" AutoEventWireup="true"
> CodeFile="Default.aspx.cs" Inherits="_Default" %>
>
> > "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
> Untitled Page
>
>
>
>
> Welcome to Visafone web content provision web application. > div>
>
>
>
>
> The content of the waspprovider.aspx.cs page is as follows:
>
> using System;
> using System.Data;
> using System.Configuration;
> using System.Collections;
> using System.Collections.Specialized;
> using System.Web;
> using System.Web.Security;
> using System.Web.UI;
> using System.Text;
> using System.Web.UI.WebControls;
> using System.Web.UI.WebControls.WebParts;
> using System.Web.UI.HtmlControls;
> using System .Collections.Generic ;
> using System.Data.SqlClient;
>
> using A3MessageProcessing;
> using A3MessageTransaction;
>
> //using Guinnesspromo;
>
> public partial class Rawurl : System.Web.UI.Page
> {
> private string _shortcode =
> System.Configuration.ConfigurationManager.AppSettings["shortcode"],
> _username =
> System.Configuration.ConfigurationManager.AppSettings["username"] ,
> _password =
> System.Configuration.ConfigurationManager.AppSettings["password"],
> _port =
> System.Configuration.ConfigurationManager.AppSettings["port"],
>
> servicename = null ;
>
> public string shortcode
> {
> get { return _shortcode; }
>
> }
>
> public string username
> {
> get { return _username; }
>
> }
>
> public string password
> {
> get { return _password; }
>
> }
>
> public string port
> {
> get { return _port; }
>
> }
>
> string responseString = null ;
>
> protected void Page_Load(object sender, EventArgs e)
> {
>
> try
> {
> Page.Title = "";
> TransactionInfo tif = new TransactionInfo();
> responseString = "Thank you... [Iconcepts TECH.]";
>
> //if (Page.Request.RawUrl.Contains("sms_src_addr=") &&
> Page.Request.RawUrl.Contains("sms_dest_addr=") &&
> Page.Request.RawUrl.Contains("sms_text="))
> if (Page.Request.RawUrl.Contains("sms_src_addr=") &&
> Page.Request.RawUrl.Contains("sms_text="))
> {
> NameValueCollection queryString =
> Page.Request.QueryString;
>
> // from here ...
> if (Page.Request.RawUrl.Contains("username="+username ) &&
> Page.Request.RawUrl.Contains("password="+password))
> {
> //string gsm = getQueryStringValue("sms_dest_addr",
> queryString).Trim();
> string gsm = "xxxxx;//Hard code the sms_dest_addr
> specifically for visafone/UCIas they requested not to see that
> querystring.
>
> if (gsm == shortcode)
> {
>
> // Correct format analysis
> tif.m_shortCode = gsm;
> tif.m_msisdn = getQueryStringValue("sms_src_addr",
> queryString);
> //tif.m_destAddressIn =
> getQueryStringValue("sms_dest_addr", queryString);
> tif.m_destAddressIn = gsm;
> tif.m_bodyIn = getQueryStringValue("sms_text",
> queryString);
> string mid = getQueryStringValue("sms_id",
> queryString);
> tif.m_dateIn = DateTime.Now.ToString("dd-MM-yyyy
> HH:mm:ss");
> //tif.m_destAddressIn = gsm; This line is a
> repetition and duplication of effort. Consider deleting this line.
> //bool toGlo = SendGLOMessage(tif, mid, out
> responseString);
> tif.m_operatorID = OperatorID.Globacom;//This was
> left till the creation of a Visafone element in the Enum. Doesn't
> cause any problems.
>
> try
> {
> TransactionInfoProcessor smsobject = null;
> smsobject = new Iconceptservices();
> if (smsobject != null)
> smsobject.processTransactionInfo(tif);
> // tif.m_bodyOut = "Thank you for
> playing ...";
>
> bool bl = LogToDatabase(tif);
>
> }
> catch (Exception er)
> {
>
> }
>
> responseString = tif.m_bodyOut;
>
> }
>
> else
> {
> responseString = "Invalid Login Credentials! [" +
> DateTime.Now.ToString() + "Iconcepts";
>
> }
> }
> else
> {
> responseString = "Wrong msg format. Port is still
> alive! [" + DateTime.Now.ToString() + "Iconcepts";
>
> }
> }
>
> //Make sure the response string length is not greater than
> 160.
> if (responseString.Length > 160)
> {
> responseString = responseString.Substring(0,
> 160);
> }
> //Trying to implement
>
> // Obtain a response object
> HttpResponse httpresponse = Page.Response;
> byte[] buffer = Encoding.UTF8.GetBytes(responseString);
>
> // Get a response stream and write the response to it
> // httpresponse.ContentLength64 = buffer.Length;
> httpresponse.ContentType = "text/plain";
> //Trying to implement returning error 404 if there is no
> content
> if (responseString.StartsWith("no content for the day"))
> {
> httpresponse.StatusCode = 404; httpresponse.Status =
> "404 Not Found";
> httpresponse.OutputStream.Write(buffer, 0,
> buffer.Length);
> httpresponse.Flush(); httpresponse.Close();
> }
> else//everything is ok here.i.e content is returned and
> client billed.
> {
> httpresponse.OutputStream.Write(buffer, 0,
> buffer.Length);
> httpresponse.Flush(); httpresponse.Close();
> }
>
> }
> catch (Exception exception)
> {
> //Console.WriteLine(exception.Message);
> //Console.WriteLine(exception.StackTrace);
> }
>
> finally
> {
> // do neccessary task here ...
> }
>
> return;
>
> }
>
> private static String getQueryStringValue(String keyName,
> NameValueCollection queryString)
>
> {
>
> String keyValue = null;
>
> // Get each header and display each value
> foreach (String key in queryString.AllKeys)
> {
> if (keyName.ToLower().CompareTo(key.ToLower()) == 0)
> {
> keyValue = queryString[key];
> }
> }
>
> return keyValue;
> }
>
> // logging sms messages to mg_transaction_log for persistent
> reference ...
> private static bool LogToDatabase(TransactionInfo tif)
> {
> Dictionary dictionary = new
> Dictionary();
> Procedure_Values procedure = null;
> procedure = new Procedure_Values();
>
> SqlParameter operatorID = null;
> procedure.pname = "operatorID";
> procedure.sqlparameter = operatorID;
> procedure.sqldbtype = SqlDbType.VarChar;
> procedure.svalue = "VISAFONE";
>
> procedure.size = 25;
> procedure.direction = ParameterDirection.Input;
> dictionary.Add(procedure.pname, procedure);
>
> procedure = new Procedure_Values();
> SqlParameter msisdn = null;
> procedure.pname = "msisdn";
> procedure.sqlparameter = msisdn;
> procedure.sqldbtype = SqlDbType.VarChar;
> procedure.svalue = tif.m_msisdn;
> procedure.size = 15;
> procedure.direction = ParameterDirection.Input;
> dictionary.Add(procedure.pname, procedure);
>
> procedure = new Procedure_Values();
> SqlParameter shortcode = null;
> procedure.pname = "shortcode";
> procedure.sqlparameter = shortcode;
> procedure.sqldbtype = SqlDbType.VarChar;
> procedure.svalue = tif.m_shortCode;
> procedure.size = 50;
> procedure.direction = ParameterDirection.Input;
> dictionary.Add(procedure.pname, procedure);
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
How to serialize and display the SOAP response from WSE2? I did use serialize and display the response from WSE1.0 by SOAPToolkits, but it looks not working on WSE2.0 as it redirects the SOAP address. Any suggestion is appreciated.

Starting new process from aspx page I know this is an asp.net question but I got no answers there. How do you start a new visible process from a asp.net page? I can use: from Main() in console application and it works fine. When I put it in

DB caching the html rendered by a .aspx page Hi, My goal is to take the entire stream spat out by .aspx pages and save them as simple strings in a database (for caching purposes). I'm not sure how I can get hold of this html stream, though - does anyone have any strategies / code sam

Problem with order that properties are set from aspx page Hi I've developed an ASP.NET server control with 2 properties, PropertyA and PropertyB. The setter for PropertyB uses the value of PropertyA to perform some checking when set at designtime. When the aspx page is opened in the designer, the properties are

Howto reference non-webcontrols on an ASPX page? Like the and pair, my control use item definitions, just they are in another assembly: some text1
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group