当我提交测验时,值将存储在会话中并显示在下一页中 [英] When I Submit The Quiz The Value Will Be Stored In Session And Display In Next Page

查看:48
本文介绍了当我提交测验时,值将存储在会话中并显示在下一页中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用会话



受保护的子btnSubmit_Click(发件人为对象,e为EventArgs)处理btnSubmit.Click



尝试



Dim sr As New IO.StreamReader(System.AppDomain.CurrentDomain.BaseDirectory& amp; amp; amp; amp; quot; \\ \\\result.txt& amp; quot;)

Dim finalresult As Integer = sr.ReadLine& lt; / pre& gt;

sr.Close()

Response.Write(& amp; quot;& amp; lt; script type =& amp; amp;#39; text / javascript& amp;#39;& amp; gt; alert( & amp;#39;你的分数是:& amp; amp; amp; amp; ampresult& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; ; / script& amp; gt;& amp; quot;)& lt; / pre& gt;

& lt; pre lang =& quot; vb& quot;& gt ; Dim sw As New IO.StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory& amp; amp; amp; quot; \\\\ultult.txt& amp; quot;)

sw .WriteLine(0)

sw.Close()& lt; / pre& gt;

& lt; pre lang =& quot; vb& quot;& gt; Catch ex As Exception



结束尝试

结束Sub& lt; / pre& gt;< / pre>

How to use session

Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click

Try

Dim sr As New IO.StreamReader(System.AppDomain.CurrentDomain.BaseDirectory &amp;amp; &amp;quot;\\result.txt&amp;quot;)
Dim finalresult As Integer = sr.ReadLine&lt;/pre&gt;
sr.Close()
Response.Write(&amp;quot;&amp;lt;script type=&amp;#39;text/javascript&amp;#39;&amp;gt;alert(&amp;#39;Your Score is : &amp;quot; &amp;amp; finalresult &amp;amp; &amp;quot;&amp;#39;);&amp;lt;/script&amp;gt;&amp;quot;)&lt;/pre&gt;
&lt;pre lang=&quot;vb&quot;&gt;Dim sw As New IO.StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory &amp;amp; &amp;quot;\\result.txt&amp;quot;)
sw.WriteLine(0)
sw.Close()&lt;/pre&gt;
&lt;pre lang=&quot;vb&quot;&gt;Catch ex As Exception

End Try
End Sub&lt;/pre&gt;</pre>

推荐答案

谷歌是你的朋友:好好经常拜访他。他可以比在这里发布问题更快地回答问题...



非常快速的搜索给出了1500万次点击: Google:Session VB [ ^ ]

我认为第一页涵盖了你需要知道的一切...... 。可能是10次。



将来,请尝试自己做至少基础研究,不要浪费你的时间或我们的时间。
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave 15 million hits: Google: "Session VB"[^]
And I think the first page covers everything you need to know...probably 10 times.

In future, please try to do at least basic research yourself, and not waste your time or ours.


这篇关于当我提交测验时,值将存储在会话中并显示在下一页中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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