如何使用查询字符串获取当前的完整aspx页面名称? [英] how do you get current full aspx page name with querystring?
本文介绍了如何使用查询字符串获取当前的完整aspx页面名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有这样的网址: http ://www.somesite.com/mypage.aspx?... value2 =再见,在VB.NET中,如何获得mypage.aspx?myvalue1 = hello& myvalue2 = goodbye"部分?
谢谢!
If I have a url like this: http://www.somesite.com/mypage.aspx?...value2=goodbye, in VB.NET, how do I get the "mypage.aspx?myvalue1=hello&myvalue2=goodbye" portion?
Thanks!
推荐答案
这里是我的一个例子周围有一个查询字符串....
您将使用myValue1而不是id。在这里,我将键连接成一个值并将它们分开。
如果不是(Request.QueryString(" id"))则什么都没有呢
Dim myString As String = Request.QueryString(" id")
如果Len(myString)= 7那么''我们有两个键
''我们应该有一个客户记录和至少一个位置记录
会话(" SelectedCustID")= myString.Substring(0,4)
会话(" LocID")= myString.Substring(5,2)
会话(" CustLocEditMode")=" MAINT"
否则
''客户存在,但不存在位置记录 - 视为新的
''但放custID到文本框中
会话(" SelectedCustID")= myString.Substring(0,4)
会话(" LocID") =""
会话(" CustLocEditMode")=" NEW"
txt CustID.Text = Session(" SelectedCustID")
结束如果
-
问候,
Gary Blakely
Dean Blakely&员工
www.deanblakely.com
" VB程序员 <做********** @ somewhere.com>在留言新闻中写道:e4 ************** @ TK2MSFTNGP05.phx.gbl ...
如果我有这样的网址: http://www.somesite.com/mypage.aspx?... value2 =再见,在VB.NET中,我如何得到mypage.aspx?myvalue1 = hello& myvalue2 = goodbye"部分?
谢谢!
here''s an example of my futzing around with a querystring....
you would use myValue1 instead of id. here, I was concatenating keys into one value and spliting them up.
If Not (Request.QueryString("id")) Is Nothing Then
Dim myString As String = Request.QueryString("id")
If Len(myString) = 7 Then ''we have both keys
''we should have a Customer record and at least one location record
Session("SelectedCustID") = myString.Substring(0, 4)
Session("LocID") = myString.Substring(5, 2)
Session("CustLocEditMode") = "MAINT"
Else
''customer exists but no location records exist - treat as new
''but put custID into textbox
Session("SelectedCustID") = myString.Substring(0, 4)
Session("LocID") = ""
Session("CustLocEditMode") = "NEW"
txtCustID.Text = Session("SelectedCustID")
End If
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"VB Programmer" <do**********@somewhere.com> wrote in message news:e4**************@TK2MSFTNGP05.phx.gbl...
If I have a url like this: http://www.somesite.com/mypage.aspx?...value2=goodbye, in VB.NET, how do I get the "mypage.aspx?myvalue1=hello&myvalue2=goodbye" portion?
Thanks!
感谢您的示例。我想知道是否有一个开箱即用的简单函数来简单地返回整个字符串,其中查询字符串可能是未知的...谢谢......
" ; GaryDean" <嘎****** @ newsgroups.nospam>在留言新闻中写道:%2 ****************** @ TK2MSFTNGP03.phx.gbl ...
这里是我的一个例子用查询字符串来讨论....
你会使用myValue1而不是id。在这里,我将键连接成一个值并将它们分开。
如果不是(Request.QueryString(" id"))则什么都没有呢
Dim myString As String = Request.QueryString(" id")
如果Len(myString)= 7那么''我们有两个键
''我们应该有一个客户记录和至少一个位置记录
会话(" SelectedCustID")= myString.Substring(0,4)
会话(" LocID")= myString.Substring(5,2)
会话(" CustLocEditMode")=" MAINT"
否则
''客户存在,但不存在位置记录 - 视为新的
''但放custID到文本框中
会话(" SelectedCustID")= myString.Substring(0,4)
会话(" LocID") =""
会话(" CustLocEditMode")=" NEW"
txt CustID.Text = Session(" SelectedCustID")
结束如果
-
问候,
Gary Blakely
Dean Blakely&员工
www.deanblakely.com
" VB程序员 <做********** @ somewhere.com>在留言新闻中写道:e4 ************** @ TK2MSFTNGP05.phx.gbl ...
如果我有这样的网址: http://www.somesite.com/mypage.aspx?... value2 =再见,在VB.NET中,我如何得到mypage.aspx?myvalue1 = hello& myvalue2 = goodbye"部分?
谢谢!
Thanks for the example. I''m wondering if there''s an out-of-the-box, simple function to simply return the whole string, where the querystrings may be unknown... Thanks...
"GaryDean" <Ga******@newsgroups.nospam> wrote in message news:%2******************@TK2MSFTNGP03.phx.gbl...
here''s an example of my futzing around with a querystring....
you would use myValue1 instead of id. here, I was concatenating keys into one value and spliting them up.
If Not (Request.QueryString("id")) Is Nothing Then
Dim myString As String = Request.QueryString("id")
If Len(myString) = 7 Then ''we have both keys
''we should have a Customer record and at least one location record
Session("SelectedCustID") = myString.Substring(0, 4)
Session("LocID") = myString.Substring(5, 2)
Session("CustLocEditMode") = "MAINT"
Else
''customer exists but no location records exist - treat as new
''but put custID into textbox
Session("SelectedCustID") = myString.Substring(0, 4)
Session("LocID") = ""
Session("CustLocEditMode") = "NEW"
txtCustID.Text = Session("SelectedCustID")
End If
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"VB Programmer" <do**********@somewhere.com> wrote in message news:e4**************@TK2MSFTNGP05.phx.gbl...
If I have a url like this: http://www.somesite.com/mypage.aspx?...value2=goodbye, in VB.NET, how do I get the "mypage.aspx?myvalue1=hello&myvalue2=goodbye" portion?
Thanks!
" VB Programmer" <做********** @ somewhere.com>在留言中写道
新闻:uL **************** @ TK2MSFTNGP05.phx.gbl ...
如果我有这样的网址:
http://www.somesite.com/mypage.aspx?...value2=goodbye ,在VB.NET中,如何获得mypage.aspx的
? myvalue1 =你好&安培; myvalue2 =再见"部分?
"VB Programmer" <do**********@somewhere.com> wrote in message
news:uL****************@TK2MSFTNGP05.phx.gbl...
If I have a url like this:
http://www.somesite.com/mypage.aspx?...value2=goodbye, in VB.NET, how
do I get the "mypage.aspx?myvalue1=hello&myvalue2=goodbye" portion?
感谢您的示例。我想知道是否有一个开箱即用,简单的功能来简单地返回整个字符串,其中查询字符串可能未知......谢谢...
Thanks for the example. I''m wondering if there''s an out-of-the-box, simple
function to simply return the whole string, where the querystrings may be
unknown... Thanks...
Request.Url给你什么?
What does Request.Url give you?
这篇关于如何使用查询字符串获取当前的完整aspx页面名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文