Click to See Complete Forum and Search --> : Response Problem


nitin.randive
April 17th, 2008, 05:15 AM
Hi !
I am new to asp.net.
I m doing a project where in a mobile user is hitting my page for login authentication where in I accept the username & password, authenticate it , and send a response to him back.

When I use GET method it works fine but theres a problem in POST method
public void subResponse(string contents)
{
txtArr = System.Text.Encoding.Default.GetBytes(contents);
try
{
Response.Clear();
Response.OutputStream.Write(txtArr, 0, txtArr.Length);
objToErrorFile.writeResponse(contents, Server.MapPath(ConfigurationSettings.AppSettings["ErrorInfoDirectory"]));
Response.BinaryWrite(txtArr);
Response.End();
}
catch (Exception ex)
{
objToErrorFile.LogToErrorFile(ex.Message, ex.StackTrace, "Class: serverform Function/Sub: subResponse", Server.MapPath(ConfigurationSettings.AppSettings["ErrorInfoDirectory"]));
}

}

I used the above code
But the response he gets is as below :-

(J2ME response)
Running with storage root DefaultColorPhone
Running with locale: English_United States.1252
Running in the identified_third_party security domain
RMS Value : 0
http://58.68.117.35:81/myEstoreIt/loginauth.aspx


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="loginauth.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGSobwWSO4/egAdSFWX+8ZI1qYf/Iw==" />

<div>

</div>
</form>
</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="loginauth.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGSobwWSO4/egAdSFWX+8ZI1qYf/Iw==" />

<div>

</div>
</form>
</body>
</html>


Please help me in solving this problem
What type of response is this ?

Thanks in adv

nitin.randive
April 17th, 2008, 06:14 AM
It also throws an exception called :-
"Unable to evaluate expression because the code is optimized or a native frame is on the top of the call stack"

Scott.Macmaster
April 17th, 2008, 09:54 AM
You rarely need to do anything with the output stream. Just add a label control and set the text property

public void subResponse(string contents)
{
label.text = content;
}

Are you trying to change the whole page? Most login pages simply redirect to the content page after authentication. Use server.transfer("contentpage.aspx").

nitin.randive
April 21st, 2008, 04:28 AM
No,I'm not tring to change whole page or anything like that

I am jus sending a response in the form of 1 or 0 (i.e valid or invalid) to the j2me application.

nitin.randive
April 21st, 2008, 04:29 AM
Well finally I am able to send correct reponse to the other j2me application but was not able to clear the exception that was mentioned above..

What is this exception all about..