ASP 和 ASP.NET 页面之间的网关页面

发布于 2024-08-15 15:35:49 字数 1505 浏览 8 评论 0原文

我承认,我对 ASP .NET 编程还很陌生,我被要求获取我们所有的网关页面(用经典 ASP 编写)并为我们拥有的少数 C# .NET 应用程序(我编写的)制作一个通用网关页面)。我尝试在这里和网络上进行搜索,但找不到任何描述执行此操作的好方法的内容,并认为我要么没有正确搜索,要么没有正确命名我想要做的事情。

我决定采用经典 ASP 中的主网关页面之一,并将其​​用作我的新网关的基础。为了避免用一堆代码让您感到厌烦,我将分步骤总结我的网关,然后可以从中获取建议/批评。

编辑:基本上我想做的是从经典的 ASP 页面转到 ASP .NET 页面,然后再返回。

编辑2:如果我的问题仍然不清楚,我会问我是否有一个正确的开始,以及是否有人对如何做得更好有建议。它可以根据需要是通用的,而不是寻找特定的现成代码答案。

我的网关页面:
在页面的第一部分中,我获取会话变量并确定用户是否通过网关离开或返回:

代码(VB 中):


uid = Request.QueryString("GUID")

如果 uid = "" 则
方向=“离开”
End If

' 收集可用的用户信息。
userid = Session("lnglrnregid")
银行 ID = 会话(“strBankid”)
' 返回位置。
Floor = Request.QueryString("Floor")

' 选择的选项将决定用户是否继续使用 SSL。
' 如果它们当前是 SSL,则应保留它们(如果选择)。
option1 = Application(bankid & "Option1")
如果 MID(选项1, 6, 1) = "1" 则
sslHttps =“s”
结束如果

接下来,我将 uid 作为称为 GUID 的唯一标识符字段输入到数据库表 (SQL-Server 2005) 中。我省略了存储过程调用。

最后,我使用方向变量来确定用户是离开还是返回,并从那里重定向到网站的不同区域。

代码(再次在 VB 中):


If direction = "Leaving" Then
Select Case floor Case "sscat", "ssassign" ' A SkillSoft course Response.Redirect("Some site here")

案例“lrcat”、“lrassign” ' 法律室课程 Response.Redirect("此处某个站点")

Case Else ' 其他一些 SCORM 课程,例如 MindLeaders 或自定义上传。 Response.Redirect("这里是某个站点") 结束选择

会话。

放弃其他 ’唯一的另一个方向是“回归” ……

到目前为止就是这样 - 正如我所说,我不是专家,所以任何建议将不胜感激!

I'll admit, I am pretty new with ASP .NET programming and I have been asked to take all our gateway pages (written in classic ASP) and make one universal gateway page to the few C# .NET applications we have (that I wrote). I tried searching here and the web and couldn't find much of anything describing a great way to do this and figured I was either not searching properly or was not properly naming what I am trying to do.

I decided to to take one of the main gateway pages we had in classic ASP and use that as a base for my new gateway. Without boring you with a bunch of code I will summarize my gateway in steps and then can take advice/critique from there.

EDIT: Basically what I am trying to do is go from a classic ASP page to a ASP .NET page and then back again.

EDIT2: If my question is still unclear I am asking if what I have an the right start and if anyone has suggestions as to how this could be better. It can be as generic as need-be, not looking for a specific off-the-shelf code answer.

My Gateway page:
In the first part of the page I grab session variables and determine if the user is leaving or returning through the gateway:

Code (in 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

Next I enter the uid into a database table (SQL-Server 2005) as a uniqueidentifier field called GUID. I omitted the stored procedure call.

Lastly, I use the direction variable to determine if the user is leaving or returning and do redirects from there to the different areas of the site.

Code (In VB again):


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" .....

That's about it so far - so like I said, not an expert so any suggestions would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮凉 2024-08-22 15:35:49

前几天发现这个几乎可以处理我想做的事情:

http ://msdn.microsoft.com/en-us/library/aa479313.aspx

Found this the other day that pretty much would handle what I was trying to do:

http://msdn.microsoft.com/en-us/library/aa479313.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文