Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2007, 12:50 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Map Path???

I would like to get the virtual path and file name of the request
Eg.
my query string is "http://www.abc.com/test.aspx"

I want to get "http://www.abc.com" and "test.aspx" separately.

What should I do???

Thanks,
TW

 
Old April 4th, 2007, 07:45 AM
Authorized User
 
Join Date: Feb 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I cannot get into much detail, but I would recommend using string regular expressions to do this. I believe that there is a code sample on Wrox on just that thing.

There are 10 types of people - Those who understand binary, and those who don't.
 
Old April 4th, 2007, 08:02 AM
Authorized User
 
Join Date: Mar 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this may work also:
http://msdn2.microsoft.com/en-us/lib....segments.aspx

 
Old April 5th, 2007, 07:26 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can split it up.

        string sUrl = "http://www.abc.com/index.aspx";

        string[] sDomain = sUrl.Split(new char[] {'/'});

        foreach (string sOut in sDomain)
        {
            Response.Write(sOut + "<br />");
        }


Of course, this will give you http: www.abc.com index.aspx but you can ignore the http or you can keep it (in case of an https or ftp or whatever) and you can parse the strings back together.

string sRebuilt = sDomain[0] + @"//" + sDomain[2];
string sPage = sDomain[sDomain.Length-1];

Output will be:
http://www.abc.com
index.aspx











Similar Threads
Thread Thread Starter Forum Replies Last Post
Heat Map over Google Map ajit Javascript 0 March 7th, 2008 09:01 AM
Error: File path and URL http map differently cJeffreywang ASP.NET 1.0 and 1.1 Basics 4 March 27th, 2007 08:03 PM
FSO Map.Path points to development site nancy Classic ASP Basics 0 April 27th, 2005 01:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.