473,414 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

how do you get current full aspx page name with querystring?

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!

Jun 17 '06 #1
10 7550
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!

Jun 17 '06 #2
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!

Jun 17 '06 #3
"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...


What does Request.Url give you?
Jun 17 '06 #4
There's no way to get it directly, but you can construct it very easily.

Dim name as string = System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
Dim fullname as string = name & "/" & qrystring

See it working at :

http://asp.net.do/test/querystring.a...value2=goodbye

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"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!

Jun 17 '06 #5
re:
What does Request.Url give you?
The complete path...including the host name, which he doesn't want.

See : http://asp.net.do/test/requesturl.aspx

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2******************@TK2MSFTNGP05.phx.gbl... "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...


What does Request.Url give you?

Jun 17 '06 #6
Thanks Juan...

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OH**************@TK2MSFTNGP04.phx.gbl...
There's no way to get it directly, but you can construct it very easily.

Dim name as string =
System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
Dim fullname as string = name & "/" & qrystring

See it working at :

http://asp.net.do/test/querystring.a...value2=goodbye

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"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!

Jun 17 '06 #7
These two new 2.0 properties of the Page are easy to use...

Page.Title = Page.AppRelativeTemplateSourceDirectory;
Page.Title = Page.AppRelativeVirtualPath;

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"VB Programmer" <do**********@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Thanks Juan...

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OH**************@TK2MSFTNGP04.phx.gbl...
There's no way to get it directly, but you can construct it very easily.

Dim name as string =
System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
Dim fullname as string = name & "/" & qrystring

See it working at :

http://asp.net.do/test/querystring.a...value2=goodbye

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"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!


Jun 18 '06 #8
They don't return what "VB Programmer" requested, Clinton.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Of*************@TK2MSFTNGP03.phx.gbl...
These two new 2.0 properties of the Page are easy to use...

Page.Title = Page.AppRelativeTemplateSourceDirectory;
Page.Title = Page.AppRelativeVirtualPath;

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/ "VB Programmer" <do**********@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Thanks Juan...

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OH**************@TK2MSFTNGP04.phx.gbl...
There's no way to get it directly, but you can construct it very easily.

Dim name as string = System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
Dim fullname as string = name & "/" & qrystring

See it working at :

http://asp.net.do/test/querystring.a...value2=goodbye

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"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!

Jun 18 '06 #9
For the most part writing splits and looping through arrays may not be
needed anymore. The point being there are other useful methods that parse
filenames, extensions and paths we often don't know about. Some others [1]
relevant to this context for example.

<%= Clinton

[1] http://aspnet.4guysfromrolla.com/articles/052505-1.aspx
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:e3****************@TK2MSFTNGP02.phx.gbl...
They don't return what "VB Programmer" requested, Clinton.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Of*************@TK2MSFTNGP03.phx.gbl...
These two new 2.0 properties of the Page are easy to use...

Page.Title = Page.AppRelativeTemplateSourceDirectory;
Page.Title = Page.AppRelativeVirtualPath;

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"VB Programmer" <do**********@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Thanks Juan...

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OH**************@TK2MSFTNGP04.phx.gbl...
There's no way to get it directly, but you can construct it very
easily.

Dim name as string =
System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
Dim fullname as string = name & "/" & qrystring

See it working at :

http://asp.net.do/test/querystring.a...value2=goodbye

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"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!


Jun 19 '06 #10
Thanks clintonG.

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
For the most part writing splits and looping through arrays may not be
needed anymore. The point being there are other useful methods that parse
filenames, extensions and paths we often don't know about. Some others [1]
relevant to this context for example.

<%= Clinton

[1] http://aspnet.4guysfromrolla.com/articles/052505-1.aspx
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:e3****************@TK2MSFTNGP02.phx.gbl...
They don't return what "VB Programmer" requested, Clinton.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in
message news:Of*************@TK2MSFTNGP03.phx.gbl...
These two new 2.0 properties of the Page are easy to use...

Page.Title = Page.AppRelativeTemplateSourceDirectory;
Page.Title = Page.AppRelativeVirtualPath;

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"VB Programmer" <do**********@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Thanks Juan...

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OH**************@TK2MSFTNGP04.phx.gbl...
> There's no way to get it directly, but you can construct it very
> easily.
>
> Dim name as string =
> System.IO.Path.GetFileName(Request.ServerVariables ("SCRIPT_NAME"))
> Dim qrystring as string = Request.ServerVariables("QUERY_STRING")
> Dim fullname as string = name & "/" & qrystring
>
> See it working at :
>
> http://asp.net.do/test/querystring.a...value2=goodbye
>
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en español : http://asp.net.do/foros/
> ===================================
> "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!



Jun 21 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Freeman | last post by:
Hi There! I'm just wondering if there's a way to pass parameters (as if you were passing parameters to a ASCX web control) when calling an ASPX page? e.g. MyDetailsPage.UserName = "david" ...
2
by: Sean Carey | last post by:
I converted a C# Upload app to VB.NET and am down to one error and was hoping someone could help me with te error. I would greatly appreciate help from anyone. Here is the error: ...
0
by: tom | last post by:
Hi all, I'm having a bit of trouble getting my site to output a certain number of results per page. Any help on this would be greatly appriciated. Without this function my code outputs all...
3
by: clintonG | last post by:
// The ServerVariables collection can help me build this: http://xp1/METRO2/HomePage.aspx // URL & QueryString generated by the 2.0 Login control click event. // What I need to capture is...
1
by: Chris Lincoln | last post by:
Hello, I can't quite seem to figure out this issue; it is specific to Firefox, as it works fine in IE. I have an iFrame within an aspx page that is passed a value in the query string (e.g....
1
by: RSH | last post by:
Hi, I have a user created control that has quite a bit of codebehind code. I have one link in the HTML page code that I need to insert the current URL in. I have tried several scenerios but...
3
by: mike | last post by:
Hello, I've got a .aspx page that passes login information to an .asp page using a querystring. The problem is its not secure, the user can see the login information right there and type in...
11
by: greg | last post by:
Hi all, Is there a way to get the current theme name at design time? I'm trying to write a custom control for which I need to use images from the current theme. I have asigned a theme to the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.