473,382 Members | 1,646 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,382 software developers and data experts.

http request

A quick question:
How do I retrieve the file name from the two URLs's:
www.mysite.com/file.aspx
or
www.mysite.com/folder/file.aspx

using the request object.

What I need is a simple way of returning the 'file.aspx'.

I've looked at request.url.segements() but this needs to specific to a
segement
In my case i need to extract the filename from any depth of url.

Any help would be appreciated - VB.net 3.5 please.

Thanks
Sep 19 '08 #1
2 979

Hi James,

Try this
System.IO.Path.GetFileName(Request.Url.ToString()) ;

Regards,
John
On Sep 19, 8:14*am, James Page <JamesP...@discussions.microsoft.com>
wrote:
A quick question:
How do I retrieve the file name from the two URLs's:www.mysite.com/file.aspx
orwww.mysite.com/folder/file.aspx

using the request object.

What I need is a simple way of returning the 'file.aspx'.

I've looked at request.url.segements() but this needs to specific to a *
segement
In my case i need to extract the filename from any depth of url.

Any help would be appreciated - VB.net 3.5 please.

Thanks
Sep 19 '08 #2
Works great.

Thank you very much
"John" wrote:
>
Hi James,

Try this
System.IO.Path.GetFileName(Request.Url.ToString()) ;

Regards,
John
On Sep 19, 8:14 am, James Page <JamesP...@discussions.microsoft.com>
wrote:
A quick question:
How do I retrieve the file name from the two URLs's:www.mysite.com/file.aspx
orwww.mysite.com/folder/file.aspx

using the request object.

What I need is a simple way of returning the 'file.aspx'.

I've looked at request.url.segements() but this needs to specific to a
segement
In my case i need to extract the filename from any depth of url.

Any help would be appreciated - VB.net 3.5 please.

Thanks

Sep 19 '08 #3

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

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
4
by: Justin Malloy | last post by:
I am using the System.Net.Webclient to try and download an XML file from a website but am receiving a HTTP protocol error when running the DownloadFile() sub routine. I did a HTTP trace using...
6
by: Microsoft News | last post by:
Hi, I have been using several http server code examples from the web, include one from msdn, and I can't seem to get a simple http server thread working. I can connect the server successful...
0
by: WIWA | last post by:
Hi, I want to login to a password protected website and fetch the content of the page behind. I have based my code on http://weblogs.asp.net/jdennany/archive/2005/04/23/403971.aspx. When I use...
3
by: Patrick Fogarty | last post by:
I am programming what is to be a web service client that will use an HTTP-POST to request and retrieve data. The remote server (written in java for what it's worth) requires basic authentication...
1
by: omantawy | last post by:
Hi, I have some legacy ASP web applications that use an unmanaged COM component to connect to a third party application. The third part application has moved to the managed code in the current...
2
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata ...
3
by: =?Utf-8?B?U3ViYQ==?= | last post by:
Hi I having a similar issue. my website url has https://blahblahblah but when i do Response.Write(Request.Url); it writes the url with http..........its really strange........i dont have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.