here is the error:
Server Error in '/CHAT' Application.
------------------------------------------------------------------------
--------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
av.a(String A_0) +32
bw.a(String A_0) +15
a3.a(Int32 A_0, String A_1) +78
chat_net3.ZbCha tPage.UserLogou t(Int32 iSiteId, String sUserName,
Int32& iErr, String& sErr) +78
ChatAPISample.C ustomLogin.Butt on2_Click(Objec t sender, EventArgs e)
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +108
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.Rai
sePostBackEvent (String eventArgument) +57
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
+33
System.Web.UI.P age.ProcessRequ estMain() +1292
it happens when there is no cookie in the machine accessing the page
and this is the button2_click code:
private void Button2_Click(o bject sender, System.EventArg s e)
{
int iSiteId=int.Par se(this.SiteIdG et());
// This is just a sample. In real application you would take those
// variable form session, form, cookies or any other method that you
use.
//string sUserId="user1" ;
HttpCookie cookie = Request.Cookies["snitz00use r"];
if(cookie == null)
{
//CookieValue represents a WebForm Label control
lblMsg.Text=str ing.Format("Fai led to log in user");
}
else
{
//CookieValue represents a WebForm Label control
lblMsg.Text=str ing.Format("wor k");
}
try
{
sUserId = cookie.Values["Name"].ToString();
}
catch
{
lblMsg.Text=str ing.Format("Fai led to log in user");
}
// string sUserId="user1" ;
string sErr="";int iErr=0;
if(this.UserLog out(iSiteId,sUs erId,ref iErr,ref sErr))
{
lblLogout.Text= string.Format(" Successfully logged out user {0} from
site {1}.",sUserId,i SiteId);
//instead you can just put all this code in your page_load event and
use redirect to chat page here.
//lnkChat.Visible =true;
}
else
{
//depending on error code you may take different action here
lblLogout.Text= string.Format(" Failed to log out user {0} from site
{1}. Error ({2}) {3}",sUserId,iS iteId,iErr,sErr );
}
RoomListRender( );
lnkChat.Visible =false;
------------------------------------------------------------------------
--------
Version Information: Microsoft .NET Framework Version:1.1.432 2.2300;
ASP.NET Version:1.1.432 2.2300
*** Sent via Developersdex
http://www.developersdex.com ***