上传到服务器时与母版页会话中出现问题 [英] problem in session with master page when upload to server

查看:115
本文介绍了上传到服务器时与母版页会话中出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用c#在asp.net中开发Web应用程序.
我在其中使用具有登录名和一个订购单的母版页.

登录和订购单已与母版页连接.

我在母版页中创建会话.并将此会话重定向到预订表格.

我正在使用web.config文件,其中会话timout = 20;

成功登录后,我填写了预订表格(至少需要2分钟.)
当我单击提交按钮.我自动在登录页面上重定向.(因为我在母版页中进行如下编码):


i m developing web application in asp.net with c#.
in which i m using master page with login and one order form.

login and order form is connected with master page.

i m creating session in master page. and redirect this session to booking form.

i m using web.config file in which session timout=20;

after successful login, i filled the booking form(which takes at least 2 minutes.)
when i clicked submit button. i m automatically redirect on login page.(because i code in master page that is as follows):

if (Session["utype"] == null)
        {
           Response.Redirect("MainLogin.aspx");
       }
      if (Session["utype"].ToString() == "Admin")
      {
           AdminDiv.Visible = true;
           UserDiv.Visible = false;
         lblusername.Visible = true;
           lblusername.Text = Session["utype"].ToString();
      }
       if (Session["utype"].ToString() == "User")
       {
         AdminDiv.Visible = false;
          UserDiv.Visible = true;
         lblusername.Visible = true;
           lblusername.Text = Session["utype"].ToString();
      }


我不明白为什么它会自动退出.

我也使用< pages enableViewStateMac ="false"/>

在web.config中.

请帮助我.

在此先谢谢您.


i can not understand that why it is automatically signed out.

i m also using <pages enableViewStateMac="false" />

in web.config.

pls help me .

thanks in advance.

推荐答案

您删除了会话超时= 20
在登录页面中,设置 Session ["utype"] =//添加类型此代码是在编写response.redirect(orderform.aspx)时添加的代码.

您还添加了global.asax文件并编写了顺畅操作
you remove the session timeout=20
in login page, you set the Session["utype"]=//you add type this code is add above of when you write response.redirect(orderform.aspx).

you also add the global.asax file and write smoething
void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        Session["utype"] = "";
        
    }



希望工作.



I hope work.


这篇关于上传到服务器时与母版页会话中出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆