Пример #1
0
        protected void Login_click(object sender, EventArgs e)
        {
            var dataSource = new ClientDataSource();

            var tmp = "";
            try {
                dataSource.Login(LoginUser.UserName, LoginUser.Password);
            } catch (ArgumentNullException) {
                tmp = "Username and/or password are null, please retry!";
            } catch (InvalidEmailException) {
                tmp = "Email is not valid, please retry!";
            } catch (InvalidPasswordException) {
                tmp = "Password is not valid, please retry!";
            } catch (UserNotExistingException) {
                tmp = "User with this credentials does not exists, please retry!";
            } finally {
                LoginUser.FailureText = tmp;
            }

            if (LoginUser.FailureText != "")
                return;
            Session["ClientDataSource"] = dataSource;
            Session["UserEmail"] = LoginUser.UserName;
            Response.Redirect("../MemberOnly.aspx");
        }
Пример #2
0
        protected void SetUp()
        {
            CloudStorageSetup.ResetStorage();
            DataSource = new ClientDataSource();
            DataSource.Login(DefaultAdminEmail, DefaultAdminPwd);

            _server = new TcpClient();

            /* estabilishing tcp connection with dispatcher */
            _server.Connect(IPAddress.Parse(ServerString), ServerPort);
            _reader = new StreamReader(_server.GetStream());
            _writer = new StreamWriter(_server.GetStream()) {AutoFlush = true};
        }