473,406 Members | 2,707 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,406 software developers and data experts.

exact url typed in browser

how i can retrieve an exact url typed by user in a browser? in
particular i'd like to get http://foo.bar.com/ without default content
page defined in 'Documents' section in iis. i can't find proper
ServerVariable, nor property in Request.
the only way i see at the moment is to write own httpmodule or put
aspnet_isapi.dll in wildcard application maps in iis application config
and check the url in Application_BeginRequest, but both are extremaly
unconvinient since i'd like to provide only a simple control for many
different sites.
or maybe it's just a misconfiguration? i use asp 1.1sp1 on iis/w2k3, but
as i mentioned -- it should work in different environments.

--
Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike&&unix^W.net;}
Nov 18 '05 #1
8 2141
> how i can retrieve an exact url typed by user in a browser? in
particular i'd like to get http://foo.bar.com/ without default content
page defined in 'Documents' section in iis.


I'm no expert, so I may be way off, but AFAIK, .net can only grab what's
given to it, so if IIS is changing the URL, then you'll have to figure out
how to pass the original through IIS.

otherwise, maybe you can use javascript ( window.location.URL ) to grab what
the browser sees and bast it back that way? Granted, that'd be dependant on
javascript then...

-Darrel
Nov 18 '05 #2
when IIS recieves a request for http://foo.bar.com/ , is scans the directory
for a default page, and if found, then sends a redirect to the browser. the
browser then sends a request the new url (this is what you see in the server
variables).

you could write a module that did not use the redirect method, but used url
rewriting and passed the original url as an additional header that the pages
could lookup.

-- bruce (sqlwork.com)
"Daniel Bauke" <bo****@bonkey.pl.eu.org> wrote in message
news:uG*************@tk2msftngp13.phx.gbl...
how i can retrieve an exact url typed by user in a browser? in
particular i'd like to get http://foo.bar.com/ without default content
page defined in 'Documents' section in iis. i can't find proper
ServerVariable, nor property in Request.
the only way i see at the moment is to write own httpmodule or put
aspnet_isapi.dll in wildcard application maps in iis application config
and check the url in Application_BeginRequest, but both are extremaly
unconvinient since i'd like to provide only a simple control for many
different sites.
or maybe it's just a misconfiguration? i use asp 1.1sp1 on iis/w2k3, but
as i mentioned -- it should work in different environments.

--
Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike&&unix^W.net;}

Nov 18 '05 #3
darrel said the following on 2004-09-15 23:50:
I'm no expert, so I may be way off, but AFAIK, .net can only grab what's
given to it, so if IIS is changing the URL, then you'll have to figure out
how to pass the original through IIS. but it should be available at least as something like
ServerVariables["BROWSER_URL"].
it is irreplaceable when you have to generate content based on the url.
when default page changes on a host you need to update it in the system,
too -- it's unconvinient and error-prone. it might be simple when you
host it for 5 sites, but what about when you serve content for 300 or
1000? i'm really disappointed that such feature may be unavailable.
otherwise, maybe you can use javascript ( window.location.URL ) to grab what
the browser sees and bast it back that way? Granted, that'd be dependant on
javascript then...

and then what i should do? reload a page? i need it on the server side,
so unfortunately it's totally unacceptable not only because of
dependency on js.

but thanks for the answer, maybe it will draw more attention to the
problem :-)
--
Daniel Bauke; http://www.bonkey.pl.eu.org;{happiness==bike&&unix^W.net; }
Nov 18 '05 #4
Have you tried using Request.Servervariables("SERVER_NAME")
or
Request.RawURL
?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"bruce barker" <no***********@safeco.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
when IIS recieves a request for http://foo.bar.com/ , is scans the
directory
for a default page, and if found, then sends a redirect to the browser.
the
browser then sends a request the new url (this is what you see in the
server
variables).

you could write a module that did not use the redirect method, but used
url
rewriting and passed the original url as an additional header that the
pages
could lookup.

-- bruce (sqlwork.com)
"Daniel Bauke" <bo****@bonkey.pl.eu.org> wrote in message
news:uG*************@tk2msftngp13.phx.gbl...
how i can retrieve an exact url typed by user in a browser? in
particular i'd like to get http://foo.bar.com/ without default content
page defined in 'Documents' section in iis. i can't find proper
ServerVariable, nor property in Request.
the only way i see at the moment is to write own httpmodule or put
aspnet_isapi.dll in wildcard application maps in iis application config
and check the url in Application_BeginRequest, but both are extremaly
unconvinient since i'd like to provide only a simple control for many
different sites.
or maybe it's just a misconfiguration? i use asp 1.1sp1 on iis/w2k3, but
as i mentioned -- it should work in different environments.

--
Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike&&unix^W.net;}


Nov 18 '05 #5
bruce barker said the following on 2004-09-16 02:21:
when IIS recieves a request for http://foo.bar.com/ , is scans the directory
for a default page, and if found, then sends a redirect to the browser.

not really. when i send such request:
GET http://foo.bar.com/ HTTP/1.0
Host: foo.bar.com
[...]
i got similar results:
- with static html as default:
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 1621
Content-Type: text/html
Content-Location: http://foo.bar.com/Default.htm
Last-Modified: Thu, 16 Sep 2004 01:36:49 GMT
Accept-Ranges: bytes
ETag: "ed660a28d9bc41:2e60"
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
Date: Thu, 16 Sep 2004 01:45:02 GMT
Connection: close
[and contents of the file]

- when aspx is a default file the answer is quite similar, but without
Content-Location header:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 16 Sep 2004 01:46:08 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 1617
[contents]

but Request.RawUrl shows "/Default.aspx". it looks like iis redirects a
request internally, maybe using Server.Transfer? anyway -- the request
is single, without additional redirection from iis.

--
Daniel Bauke; http://www.bonkey.pl.eu.org;happiness==bike&&unix^W.net;}
Nov 18 '05 #6
Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 03:39:
Have you tried using Request.Servervariables("SERVER_NAME")
or Request.RawURL

no, both doesn't work for me. SERVER_NAME might be useful only when i
check this in a root directory, but i may need also a foo.bar.com/xyxy/
url. and RawUrl shows a current file, which i want to avoid.

--
Daniel Bauke; http://www.bonkey.pl.eu.org;happiness==bike&&unix^W.net;}
Nov 18 '05 #7
You could do a little string parsing to trim off the current file.
There are classes in the system.IO.Path namespace that might help.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Daniel Bauke" <bo****@bonkey.pl.eu.org> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 03:39:
Have you tried using Request.Servervariables("SERVER_NAME")
or Request.RawURL

no, both doesn't work for me. SERVER_NAME might be useful only when i
check this in a root directory, but i may need also a foo.bar.com/xyxy/
url. and RawUrl shows a current file, which i want to avoid.

--
Daniel Bauke; http://www.bonkey.pl.eu.org;happiness==bike&&unix^W.net;}

Nov 18 '05 #8
Steve C. Orr [MVP, MCSD] said the following on 2004-09-16 06:49:
You could do a little string parsing to trim off the current file.
There are classes in the system.IO.Path namespace that might help.

yes, i can, but i have no clue, when it is necessary. we consider a
general situation: what is the url in a browser? it may be any of:
- http://foo.bar.com/
- http://foo.bar.com/Default.aspx
- http://foo.bar.com/xyxy/NotDefault.aspx
- http://foo.bar.com/xyxy/
- http://foo.bar.com/xyxy/?param1=no&param2=yes
and i'd like to have an exact url which the browser requested. if
browser asks for /xyxy/NotDefault.aspx i cannot remove a file from the
url, because there's no reason for that.
but if there's a method to get default content files for the directory
in iss i would be very glad to use it.

--
Daniel Bauke; http://www.bonkey.pl.eu.org; happiness==bike&&unix^W.net;}
Nov 18 '05 #9

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

Similar topics

1
by: jason | last post by:
Could someone help me figure out how to utilize .servervarialbles (or another creative method) to do the following: If someone types into browser (or clicks a querystring hyperlink) with the...
2
by: Freed Flinstone | last post by:
Why after adding a dll (with dataset schemas) to my project I can access and use my the typed datasets, then for no reason say 5mins later I can no longer fully access them. The inteliSence goes from...
2
by: Mark | last post by:
Just wanted to confirm that my understanding of a strongly typed language is correct: 1. .NET is a strongly typed language because each variable / field must be declared a specific type (String,...
20
by: Dennis | last post by:
I use the following code for a strongly typed arraylist and it works great. However, I was wondering if this is the proper way to do it. I realize that if I want to implement sorting of the...
5
by: Jørn Jensen | last post by:
According to a Microsoft article a typed dataset is available through intellisense and can be accessed like in this example: TextBox1.Text = NorthwindDataSet.Customers(3).ContactName I have...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
4
by: Martin Walke | last post by:
Hi all, I have a application that runs an asp page launched by an onunload event of a page. If the user types a URL into the address line of the browser, i need to be able to redirect him to...
5
by: Andy B | last post by:
I have 2 TextBoxes and an Add button on a page. When the user fills in the TextBoxes, the values are added to a dataset table. When the page gets done reloading, the TextBoxes are turned into...
4
by: arjunalwaysbusy | last post by:
hi can any one please tell me that how to make browser goto address other than i typed in address bar......... means i type google.com browser should open yahoo.com
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.