473,761 Members | 10,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding out web application URL

m
Hello

I need to find out full URL of my application name, I tried using
Request.ServerV ariables["SERVER_NAM E"] but it returns only serverername,
and I need virtual directory name as well.

Thnx in advance
Nov 19 '05 #1
4 5428
"URL" will give you the full path, not including hostname. I believe there
is also a "RAW_URL" or "URL_RAW" that gives you the full path.

<m@s.hr> wrote in message news:ct******** **@sunce.iskon. hr...
Hello

I need to find out full URL of my application name, I tried using
Request.ServerV ariables["SERVER_NAM E"] but it returns only serverername,
and I need virtual directory name as well.

Thnx in advance

Nov 19 '05 #2
m
MWells wrote:
"URL" will give you the full path, not including hostname. I believe there
is also a "RAW_URL" or "URL_RAW" that gives you the full path.


Yes, I found that variable, but the problem again is that i don't know
if path given starts with a virtual directory or plain directory. The
idea was to separate servername + virual_director y part from "plain"
directory path.

Nov 19 '05 #3
Use APPL_PHYSICAL_P ATH for dos directory name or PATH_INFO for virtual
directory name.

<m@s.hr> wrote in message news:ct******** **@sunce.iskon. hr...
MWells wrote:
"URL" will give you the full path, not including hostname. I believe
there
is also a "RAW_URL" or "URL_RAW" that gives you the full path.


Yes, I found that variable, but the problem again is that i don't know if
path given starts with a virtual directory or plain directory. The idea
was to separate servername + virual_director y part from "plain" directory
path.

Nov 19 '05 #4
Using the "Request" .Net Framework class ( System.Web.Http Request )
should be a little faster and more efficient than using Request.ServerV ariables.

RequestUrl.aspx :
-------------------------
<%@ Page Language="VB" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim url1 As String = Request.Url.ToS tring
Label1.Text = url1
End Sub
</script>
<head>
<title>Retrie ve Full URL</title>
</head>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label" Width="238px" Height="19px"></asp:Label><br />
</div>
</form>
</body>
</html>
-----------

If you only need the Application's virtual path, use :
Request.Applica tionPath.ToStri ng

If you only need the full virtual path, use :
Request.RawUrl. ToString

Juan T. Llibre
ASP.NET MVP
===========
"MWells" <outbound__at_s ygnal.com> wrote in message news:uf******** ******@TK2MSFTN GP12.phx.gbl...
"URL" will give you the full path, not including hostname. I believe there
is also a "RAW_URL" or "URL_RAW" that gives you the full path.

<m@s.hr> wrote in message news:ct******** **@sunce.iskon. hr...
Hello

I need to find out full URL of my application name, I tried using
Request.ServerV ariables["SERVER_NAM E"] but it returns only serverername,
and I need virtual directory name as well.

Thnx in advance


Nov 19 '05 #5

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

Similar topics

22
2687
by: Tony Houghton | last post by:
I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use "~/.bombz", in Windows something like "C:\Documents And Settings\<user>\Applicacation Data\Bombz". There are plenty of messages in the archives for this group about how to find the correct location in Windows, but what about Mac OS? There I don't know the correct location for this sort of thing at...
6
7080
by: Jay Bienvenu | last post by:
I have the following Visual Basic .NET code in an ASP.NET project: ' ... Dim xdStructure As XmlDocument Dim xnStructureRoot As XmlNode xdStructure = New XmlDocument xdStructure.Load(Server.MapPath("~/xml/Structure.xml"))
15
7246
by: Twan Kennis | last post by:
Hi, I have a DB2 database on the IBM iSeries platform, on which I created several Stored Procedures with the SQLCODE as a return-parameter. These Stored Procedures are called from a Windows application (build in Visual Basic) using an ADO/OLE DB Provider on a IBM Client Access ODBC driver. On the Internet I found a whitepaper "SQL messages and codes" provided by IBM which describes a complete list of all SQLSTATEs, SQLCODEs and
0
835
by: Craig Graham | last post by:
I have an application that occasionally throws up an "open datareader associated with this connection". Obviously there is a path that leads to a datareader being left hanging; however finding it will be difficult since there are lots of different ways to go around the application and knowing which database operation was carried out immediately before the one generating the error is difficult. The error is very rare, which adds to the...
6
1262
by: Tor Inge Rislaa | last post by:
Finding current Procedure I want to write errors to a log-file, where the error log contain the description of where the error occurred and what kind of error it was. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click On Error GoTo errHandler
2
1377
by: JH | last post by:
I want to do a custom setup using some files after installing my application? How do I get the directory where my application is installed? Can some one please help me with the code New to VB here
9
2307
by: Laurent Bugnion | last post by:
Hi, I am wondering what is the best way to find out which ASP.NET sessions are still active. Here is the reason: I have a custom control which can upload files. It saves the files in a folder named after the SessionID. At Session_End, I do some cleanup and delete the "session folder". However, if the PC is rebooted before the session times out, the clean up never happens. So what I wanted to do isL: In my CleanUp method, check all...
2
2851
by: ElkGroveR | last post by:
Hi there! I'm using PHP to create a simple, dynamic MySQL SELECT query. The user chooses a selection from a HTML Form SELECT element's many options and submits the form via a POST action. The SELECT query is built as follows: $itemtype = stripslashes(trim($_POST));
5
2159
by: ron.longo | last post by:
Is there any way that I can find the path of the main .py file of my application? For example, I have an application with some resources which are in a subdirectory: myPythonApp.py /resources image1
7
2760
by: Nick | last post by:
Hi there, I have a website that functions fine locally, but when published to the server it develops a bottleneck during loading some of the pages. Basically what happens is the page loads to about 25% then it freezes for anything from 10 - 40 seconds, before suddenly loading the rest of the page. Of course I understand that this could be down to some code on the page locking the thread or suchlike, but I would like to be able to be...
0
9333
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.