tagUserResponse UserResponse = new tagUserResponse();
                tagRegResult regResult = new tagRegResult();
                IntPtr intPut = new IntPtr();
                Response.Write(UserResponse.m_Accounts);
                UserResponse.m_Accounts = null;
                UserResponse.m_Nick = null;
             
               
                string APILoginName = m_type+ name;//api用户通行证
                UserResponse.m_Accounts = WebHelper.SafePost("TextBoxNickName", null);//用户名
                UserResponse.m_Birthday = WebHelper.SafePost("Birthday", 0);//生日
                UserResponse.m_City = WebHelper.SafePost("City", null);//城市
                UserResponse.m_Compellation = WebHelper.SafePost("Compellation", null);//姓名
                UserResponse.m_ContactAddress = WebHelper.SafePost("ContactAddress", null);//地址
                UserResponse.m_ContactCode = WebHelper.SafePost("ContactCode", 0);//邮编
                UserResponse.m_Email = WebHelper.SafePost("Email", null);//邮箱
                UserResponse.m_MachineID = "";//机器号
                UserResponse.m_MobileNO = WebHelper.SafePost("MobileNO", null);//手机号码
                UserResponse.m_Nick = WebHelper.SafePost("TextBoxNickName", null);//昵称
              //  UserResponse.m_Nick = WebHelper.SafePost("MobileNO", null);
                UserResponse.m_PassPortID = WebHelper.SafePost("PassPortID", null);//身份证
                UserResponse.m_PlazaVersion = 0;//广场版本
                UserResponse.m_Province = WebHelper.SafePost("Province", null);//省
                UserResponse.m_Pwd = WebHelper.MD5("aaa");//密码
                UserResponse.m_QQNumber = WebHelper.SafePost("QQNumber", 0); ;//QQ号码
                UserResponse.m_Sex = Convert.ToChar(WebHelper.SafePost("RadioSex", 1));//性别
                UserResponse.m_Spreadid = WebHelper.SafePost("SpreadId", 0);//推荐账号
   
                intPut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(tagRegResult)));
                IntPtr outPut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(tagUserResponse)));
                UserRegister(ref UserResponse, intPut);
                object obj = Marshal.PtrToStructure(intPut, typeof(tagRegResult));
                regResult = (tagRegResult)obj;
                Marshal.Release(intPut);
                Marshal.Release(outPut);
                string a = regResult.m_Des;
                int b = regResult.m_Result;//2为已存在账号不能注册,0为成功
                long c = regResult.m_UserID;
 /// <summary>
        /// 注册参数
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct tagUserResponse
        {            public Int32 m_PlazaVersion;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)]
            public string m_MachineID;            public char m_Sex;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 13)]
            public string m_Accounts;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 13)]
            public string m_Nick;            public Int64 m_Spreadid;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
            public string m_PassPortID;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)]
            public string m_Compellation;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)]
            public string m_Pwd;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)]
            public string m_Email;            public Int64 m_Birthday;
            public Int32 m_ContactCode;
            public Int64 m_QQNumber;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
            public string m_Province;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
            public string m_City;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
            public string m_MobileNO;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string m_ContactAddress;        }        [StructLayout(LayoutKind.Sequential)]
        public struct tagRegResult
        {
            public int m_Result;
            public Int64 m_UserID;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public String m_Des;
        }        [DllImport("JointOperationClient.dll", CharSet = CharSet.Ansi, EntryPoint = "UserRegister", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr UserRegister( ref  tagUserResponse UserResponse, IntPtr RegResult);第一次注册能成功,第二次第三次传过去的值都是第一次的值,在控制台里面同样的代码没有问题。。求助这是为什么C++ASP.NETCache

解决方案 »

  1.   

    关键你是怎么传给那个页面的可以在页在上加入下面代码试试,不行就在调用的时候加上?no-cache=[随机数] Response.CacheControl = "no-cache"; //清除缓存
      

  2.   

     UserRegister(ref UserResponse, intPut); 这个是将参数传到C++写的方法里面,每次传过去的UserResponse都是一样的,在控制台里面就不会出现这种情况