副站要获取主站中用户123123123的头像,应该写一句byte[] data = new WebClient().DownloadData("http://主站/get_photo?userid=123123123");输出的就是头像图片的字节。然后主站,可以检查对方的IP,确定只有客户端是副站时才响应。

解决方案 »

  1.   

    想了一下,用户上传头像时,同时提交到两个表里就行了,麻烦帮我看看,这里怎么写,可以让user_icon,同时提交到另一个数据库AAA,BBB表的usericon值,,它们是同步注册的。拜托了
    这是前台: <input name="user_icon" id="user_icon" value="<%=user_icon %>" size="60" maxlength="200" onblur="getImg();" type="text"/><a href="javascript:void(0);" onclick="updisp();">  上传</a> <br />这是后台: private void get_uinfo()
            {
                DataView defaultView = Conn.GetDataSet("select * from ov_user where userid=" + asoon.BLL.page.usercp.usercp.u.id).Tables[0].DefaultView;            this.uid = asoon.BLL.page.usercp.usercp.u.id.ToString();
                this.uname = asoon.BLL.page.usercp.usercp.u.name.ToString();
                if (defaultView.Count > 0)
                {
                    this.user_icon = defaultView[0]["user_icon"].ToString();
                    this.truename = defaultView[0]["truename"].ToString();
                    this.sex = defaultView[0]["sex"].ToString();
                    if (!string.IsNullOrEmpty(defaultView[0]["birthday"].ToString()))
                    {
                        this.birthday = TypeParse.ToDateTime<object>(defaultView[0]["birthday"]);
                    }
                    this.homepage = defaultView[0]["homepage"].ToString();
                    this.email = defaultView[0]["email"].ToString();
                    this.qq = defaultView[0]["qq"].ToString();
                    this.msn = defaultView[0]["msn"].ToString();
                    this.tel = defaultView[0]["tel"].ToString();
                    this.address = defaultView[0]["address"].ToString();
                    this.province = defaultView[0]["province"].ToString();
                    this.area = defaultView[0]["area"].ToString();
                    this.city = defaultView[0]["city"].ToString();
                    this.job = defaultView[0]["job"].ToString();
                    if (this.sex == "0")
                    {
                        this.sexchk[0] = "checked=\"checked\"";
                    }
                    else
                    {
                        this.sexchk[1] = "checked=\"checked\"";
                    }
                }
            }
      

  2.   

    可能你又会问:“哎呀,我不知道Conn.GetDataSet(....)这行代码如何调用两次、每一次都只是数据库连接字符串稍微变化。请直接给我写代码吧。”我想这个问题,你还是要找到你们自己的封装这个 Conn 类的人去让他给你解决。如果同事写的 Conn 类代码你看不懂,你又不想不耻下问地问她,干脆自己写一个 Conn 类并且完成这个功能就行了。