我承认,我是ASP .NET编程的新手,我被要求使用我们所有的网关页面(用经典的ASP编写),并为我们拥有的几个C#.NET应用程序创建一个通用网关页面(我写的)。我试着在这里和网上搜索,并且找不到任何描述这种方式的好方法,并且发现我要么没有正确搜索,要么没有正确地命名我想要做的事情。
我决定采用我们在经典ASP中使用的一个主要网关页面,并将其用作我的新网关的基础。如果不厌倦了一堆代码,我会逐步总结我的网关,然后从那里接受建议/批评。
编辑:基本上我要做的是从经典的ASP页面转到ASP .NET页面然后再回来。
EDIT2:如果我的问题仍然不清楚,我会问我是否有一个正确的开始,如果有人有关于如何更好的建议。它可以像需要一样通用,而不是寻找特定的现成代码答案。
我的网关页面:
在页面的第一部分,我抓住会话变量并确定用户是离开还是通过网关返回:
代码(VB中):
uid = Request.QueryString("GUID")
If uid = "" Then
direction = "Leaving"
End If
' Gather available user information.
userid = Session("lnglrnregid")
bankid = Session("strBankid")
' Return location.
floor = Request.QueryString("Floor")
' The option chosen will determine if the user continues as SSL or not.
' If they are currently SSL, they should remain if chosen.
option1 = Application(bankid & "Option1")
If MID(option1, 6, 1) = "1" Then
sslHttps = "s"
End If
接下来,我将uid作为名为GUID的uniqueidentifier字段输入数据库表(SQL-Server 2005)。我省略了存储过程调用。
最后,我使用direction变量来确定用户是离开还是返回,并从那里重定向到站点的不同区域。
代码(再次在VB中):
If direction = "Leaving" Then
Select Case floor
Case "sscat", "ssassign"
' A SkillSoft course
Response.Redirect("Some site here")
Case "lrcat", "lrassign"
' A LawRoom course
Response.Redirect("Some site here")
Case Else
' Some other SCORM course like MindLeaders or a custom upload.
Response.Redirect("Some site here")
End Select
Session.Abandon
Else
' The only other direction is "Returning"
.....
到目前为止这是关于它的 - 就像我说的那样,不是专家所以任何建议都会受到高度赞赏!