Hi Friends,

This is Satish From Hyd. I am Facing Ajax compile Error.

It is "Members Names cannot be the  Same as their Enclosing Type.

Error in following  Program. I mentioned below line ERROR with inbrackets...

Plz  Reply To me    ASAP

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

--------------public partial class Ajax : 
System.Web.UI.Page--------------------(
{
    private static String keyValue = String.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        String cbRef = Page.ClientScript.GetCallbackEventReference(this, 
"arg", "loginStatus", "context");
        String cbScript = String.Empty;

        // Declaration for client callback function
        cbScript = "function doLogin(arg, context)" + "{" + cbRef + "};";

        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), 
"doLogin", cbScript, true);

        //      Generate client crypto Key
        if (!IsCallback)
        {
            keyValue = String.Empty;

            Random randomKey = new Random();

            Int32 lenght = 33;

            while (0 < lenght--)
                keyValue += Convert.ToChar(randomKey.Next(33, 122));

            key.Value = keyValue;
        }
    }
    // Implements ICallbackEventHandler
---------   public partial class Ajax : 
System.Web.UI.ICallbackEventHandler---------(error)
    {
        public String RaiseCallbackEvent(String eventArgument)
        {
            String returnValue;

            if (String.IsNullOrEmpty(eventArgument))
            {
                returnValue = "-1";
            }
            else
            {
                returnValue = eventArgument.ToString();

                String[] s = returnValue.Split(new String[] { "|" }, 
StringSplitOptions.None);
                String[] top = new String[31];
                String[] bottom = new String[31];
                String[] data = new String[2];
                Byte[] dataCodes = new Byte[16];
                Int32 checkSum = 0;
                Int32 j = 0;
                Int32 k = 0;

                data[0] = s[2];
                data[1] = s[3];

                top = Dec2Bin(Convert.ToInt64(s[0]));
                bottom = Dec2Bin(Convert.ToInt64(s[1]));

                //      Extract UserName
                data[0] = extractData(data[0], top, bottom, 0);
                //      Extract Password
                data[1] = extractData(data[1], top, bottom, 16);

                // Finally check for integrity of message
                while (j < data.Length)
                {
                    dataCodes = Encoding.ASCII.GetBytes(data[j]);
                    k = 0;

                    while (k < dataCodes.Length)
                    {
                        checkSum += dataCodes[k];
                        k++;
                    }

                    j++;
                }

                // Add pipe ASCII code
                checkSum += 124;

                // If checSum (Server Side) not match
                // checkSum (client Side) return error
                if (checkSum.ToString() != s[4])
                {
                    returnValue = "-1";
                }


                
//------------------------------------------------------------------------------
                // At this point you can manipulate data in authenticate 
process
                // versus SQL Database or  other Database type, through
                // .Net Cryptographics libraries or custom methods
                
//------------------------------------------------------------------------------
            }

            // return token received for apresentation propossal
            return returnValue;
        }

        // Conert Integer to Binary
        private String[] Dec2Bin(Int64 decValue)
        {

            String[] temp = new String[32];
            String[] binary = new String[32];
            Byte j = 0;

            // Conversion Decimal to Binary
            while (j < 32)
            {
                temp[j] = ((decValue % 2) > 0) ? "1" : "0";
                decValue = decValue / 2;

                j++;
            }

            j = 0;

            // Flip results
            while (j < 32)
            {
                binary[j] = temp[temp.Length - (j + 1)];

                j++;
            }

            return binary;
        }


        //      Extract token message
        private String extractData(String data, String[] top, String[] 
bottom, Int32 offset)
        {

            Int32 j = 0;
            Int32 k = 0;
            Byte[] keyCode = new Byte[1];
            Byte[] dataCode = new Byte[1];
            Byte[] codeResult = new Byte[16];
            String dataResult = String.Empty;

            while (j < 16)
            {

                // for the second data array
                if (offset > 0)
                {
                    k = j + offset;
                }
                else
                {
                    k = j;
                }

                keyCode = Encoding.ASCII.GetBytes(keyValue.Substring(k, 1));
                dataCode = Encoding.ASCII.GetBytes(data.Substring(j, 1));

                // Revert encryption
                if (top[k] == "1")
                {
                    codeResult[j] = Convert.ToByte(dataCode[0] - keyCode[0] 
+ 122);

                    if (bottom[k] == "1")
                    {
                        codeResult[j] = Convert.ToByte(codeResult[j] - 33);
                    }
                }
                else if (dataCode[0] != keyCode[0])
                {
                    codeResult[j] = Convert.ToByte(dataCode[0] - 
keyCode[0]);
                }

                j++;
            }

            // Cleanup dataResult from \0 chars
            Regex regExp = new Regex(@"\0");
            dataResult = 
regExp.Replace(Encoding.ASCII.GetString(codeResult), String.Empty);

            return dataResult;
        }
    }
    protected void Button_Click(object sender, EventArgs e)
    {

    }
}

_________________________________________________________________
One and only Ash. Find out all about her. Only on MSN Search 
http://server1.msn.co.in/profile/aishwarya.asp


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info/

Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---

Reply via email to