通过检查asp.net中的会话来显示元素

时间:2018-07-28 14:11:10

标签: asp.net-mvc session-cookies

I want to show element (div element) by checking 
Session of user It means if User didn't login when Click on the TextArea show Login page with 
Here is my code...
    <script>

        $(document).ready(function () {

            $('.form-control').click(function () {
                $('.form').show();
                return false;
            });
        });
        </script>

///文本区域代码

<div class="form-group">

<textarea class="form-control" name="Text" id="Text" rows="5" data-rule="required"  placeholder="message" onclick="loginfunction"></textarea>
                    <input type="hidden" name="Date" id="Date" class="form-control" value="@DateTime.Now" />
                    <div class="validation"></div>
                </div>

////登录页面代码

<div class="form" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog">
                    <div class="loginmodal-container">
                        <h1>Login to Your Account</h1><br>
                        <form>
                            <input type="text" name="user" placeholder="Username">
                            <input type="password" name="pass" placeholder="Password">
                            <input type="submit" name="login" class="login loginmodal-submit" value="Login">
                        </form>

                        <div class="login-help">
                            <a href="#">Register</a>  <a href="#">Forgot Password</a>
                        </div>
                    </div>
                </div>
            </div>

然后将会话放在隐藏的文本框中

<input type="hidden" id="cuser2" value="@Session["LoginUSERS1"]" />

我试图用一些代码解决这个问题 但是我不明白这个问题

0 个答案:

没有答案