locked
when more than 2 user access same aspx page that time data that page is mixed RRS feed

  • Question

  • hi,

    I am sanjay togadiya. I am .net developer. In that i take on .aspx page for make XML and send it to other URL page. In that when more than two user access this same page that time mix that data of that page of variable like, Datatable value of the all user same, other string, int all the variable value make the same.

    So, i can't get real output.

    I want to make this .aspx page as per user data of varible not mix and it make static for all page call for that what can i do?

    Please, help me.....

    public partial class Home : System.Web.UI.Page

    {

        static DataTable dtCountry, dtState, dtCity, dtArea, dtMobileNo;
        static string sCountryID = "", sStateID = "", sCityID = "", sAreaID = "", sMobileNo = "";

        Sponsor objSponsor = new Sponsor();

        static int iBalance, iNoofSMS, iTotalSMS, iWantSMS = 0, iWaitTime = 10, iMaximumSMS = 25000, iFileSMS=5000;



    protected void btnYes_Click( object sender, ImageClickEventArgs e )

    {

        string sSMS = txtSMS.Text, sOutbox = Server.MapPath( "Outbox" );

        string sFileNameOfXML = sOutbox + "\\SMS" + DateTime.Now.ToString( "yyMMddHHmmss" ) + ".xml";

        XmlDocument xmlSMS = new XmlDocument();

        XmlTextWriter xmlWriter = new XmlTextWriter( sFileNameOfXML, Encoding.GetEncoding( "ISO-8859-1" ) );

        xmlWriter.Formatting = Formatting.Indented;

        xmlWriter.WriteProcessingInstruction( "xml", "version='1.0' encoding='ISO-8859-1'" );

        xmlWriter.WriteStartElement( "MESSAGE" );

        xmlWriter.Close();

        xmlSMS.Load( sFileNameOfXML );

        XmlNode xmlNode = xmlSMS.DocumentElement;

        XmlElement xmlElement = xmlSMS.CreateElement( "USER" );

        xmlNode.AppendChild( xmlElement );

        XmlElement SMS = xmlSMS.CreateElement( "SMS" );

        SMS.SetAttribute( "TEXT", sSMS );

        xmlNode.AppendChild( SMS );

        xmlSMS.Save( sFileNameOfXML );

        int i = 0, j = 0, iCount = dtMobileNo.Rows.Count, iNewFile = iFileSMS;

        if( sMobileNo != "" )

        {

            iWantSMS--;

            xmlElement = xmlSMS.CreateElement( "ADDRESS" );

            xmlElement.SetAttribute( "TO", "91" + sMobileNo );

            SMS.AppendChild( xmlElement );

            xmlSMS.Save( sFileNameOfXML );

        }

        #region Write sms in XML file and SENd to Destination

        while( i != iWantSMS )

        {

            if( j == iCount )

            {

                j = 0;

                if( sAreaID == "0" )

                {

                    if( sCityID == "0" )

                    {

                        if( sStateID == "0" )

                        {

                            dtMobileNo = objSponsor.GetMobileNoOfCountry( sCountryID, "0" );

                        }

                        else

                        {

                            dtMobileNo = objSponsor.GetMobileNoOfState( sCountryID, sStateID, "0" );

                        }

                    }

                    else

                    {

                        dtMobileNo = objSponsor.GetMobileNoOfCity( sCountryID, sStateID, sCityID, "0" );

                    }

                }

                else

                {

                    dtMobileNo = objSponsor.GetMobileNoOfArea( sCountryID, sStateID, sCityID, sAreaID, "0" );

                }

                iCount = dtMobileNo.Rows.Count;

            }

            xmlElement = xmlSMS.CreateElement( "ADDRESS" );

            xmlElement.SetAttribute( "TO", "91" + dtMobileNo.Rows[j]["MobileNo"].ToString() );

            SMS.AppendChild( xmlElement );

            xmlSMS.Save( sFileNameOfXML );

            i++;

            j++;

        }

        #region Send SMS File to Destination

        while( true )

        {

            int iStatus = Convert.ToInt32( objSponsor.SMSFile( xmlSMS.InnerXml ) );

            if( iStatus == 1 )

            {

                break;

            }

        }

        #endregion

        #endregion}


    }

    Monday, June 30, 2008 8:25 AM