学习笔记-运用单点登录,搭建演示系统。原创
金蝶云社区-请输入昵称___
请输入昵称___
23人赞赏了该文章 324次浏览 未经作者许可,禁止转载编辑于2023年01月17日 09:51:59

image.png

搭建一个对外的演示系统

  1. 选择一台电脑作为服务器,固定局域网IP地址,向网络运营商申请公网IP,配置动态域名。

  2. 在路由器上配置80端口映射

  3. 搭建一个简单的中转网站(后台代码)

  4.  protected void Page_Load(object sender, EventArgs e)
            {
                htmls = ""; ftitle = "暂无";
                string id = Request.QueryString["id"]??"";          
                if (id == "")
                {
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('地址不正确');</script>");
                    htmls = " <h3 class='cred form - signin - heading'>地址不正确</h3>";
                }
                else
                {
                    string filepath = Server.MapPath("") + "\\init.txt";             
                    if (File.Exists(filepath))
                    {
                        string str;
                         StreamReader sr = new StreamReader(filepath, false);
                        str = sr.ReadToEnd().ToString();
                        sr.Close();
                        str = str.Replace("\r", "").Replace("\n", "");
                        string[] tmp1 = str.Split(';');
                        int i = 1;
                        foreach (string tl in tmp1) {
                            if (tl.Trim() == "") {
                                continue;
                            }
                            string[] tmp2 = tl.Split(',');
                            if (tmp2[0] == id) {
                                //ID 0,TITLE 1,LOGINNAME 2,UNAME 3,DBID 4,APPID 5,APPSER 6,FORMID 7,FID 8
                                string ud = KingdeeSSO.GetKingdeeUrl(tmp2[3], "", "", tmp2[5], tmp2[6], tmp2[4], "");
    
                                ftitle = tmp2[1];
                                htmls +="<div class='loginBtnInfo'><button class='btnLogin'  onclick='goto(\""+ud+"\")' style='height: 100%;width:100%' type='button' class='btnlogin k-button' tabindex='"+i.ToString()+"'>"+ tmp2[2] + "</button></div>";
                                i++;
                            }
                        }
                    }
                    if (htmls == "") {
                        htmls = " <h3 class='cred form - signin - heading'>地址不正确</h3>";
                    }
                    
                }
            }

    前台代码

    image.png

    配置文件,用,和;进行简单区分

    image.png

  5. 将网站发布至Default Web Site下

    image.png

  6. 客户访问地址http://域名(或IP):对外端口/新增加应用的别名/login.aspx?id=客户代码

    image.png


    上传图片

赞 23