Simple Q - get the base URL of a portal
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Simple Q - get the base URL of a portal

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Marc Jennings
Guest





Posted: Wed Jan 19, 2005 3:56 pm    Post subject: Simple Q - get the base URL of a portal Reply with quote

Hi there,

Is there a simple method* to return the base URL of the current
portal, wherever you are within the portal, please?

eg. In a webpart on page
http://theportal.example.com/C5/Monkeys/flour.aspx I would like to
know that the base of my portal is http://theportal.example.com/ .

Currently, I have the rather hacky method of

Quote:
string PortalUrl = Page.Request.Url.ToString().Replace(Page.Request.RawUrl.ToString(),"/");

but I know it is wildly inelegant, and potentially inaccurate in some
circumstances.

* I am not proud. If someone tells my I can call a simple and well
known parameter/method in one of the standard classes to do this, I'll
be just as grateful as if someone posts 500 lines of code.

TIA
Marc.
Back to top
Info Path
Guest





Posted: Wed Jan 19, 2005 6:29 pm    Post subject: Re: Simple Q - get the base URL of a portal Reply with quote

See this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tsmSPSiteOpenWeb1.asp

cb

"Marc Jennings" <MarcJennings@community.nospam> wrote in message
news:h2asu0d9tomoikif034pfgq07gvctpoakj@4ax.com...
Quote:
Hi there,

Is there a simple method* to return the base URL of the current
portal, wherever you are within the portal, please?

eg. In a webpart on page
http://theportal.example.com/C5/Monkeys/flour.aspx I would like to
know that the base of my portal is http://theportal.example.com/ .

Currently, I have the rather hacky method of

string PortalUrl =
Page.Request.Url.ToString().Replace(Page.Request.RawUrl.ToString(),"/");

but I know it is wildly inelegant, and potentially inaccurate in some
circumstances.

* I am not proud. If someone tells my I can call a simple and well
known parameter/method in one of the standard classes to do this, I'll
be just as grateful as if someone posts 500 lines of code.

TIA
Marc.
Back to top
Info Path
Guest





Posted: Wed Jan 19, 2005 6:36 pm    Post subject: Re: Simple Q - get the base URL of a portal Reply with quote

Sorry,

See this :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tscSPSite.asp
on the portalUrl property



"Marc Jennings" <MarcJennings@community.nospam> wrote in message
news:h2asu0d9tomoikif034pfgq07gvctpoakj@4ax.com...
Quote:
Hi there,

Is there a simple method* to return the base URL of the current
portal, wherever you are within the portal, please?

eg. In a webpart on page
http://theportal.example.com/C5/Monkeys/flour.aspx I would like to
know that the base of my portal is http://theportal.example.com/ .

Currently, I have the rather hacky method of

string PortalUrl =
Page.Request.Url.ToString().Replace(Page.Request.RawUrl.ToString(),"/");

but I know it is wildly inelegant, and potentially inaccurate in some
circumstances.

* I am not proud. If someone tells my I can call a simple and well
known parameter/method in one of the standard classes to do this, I'll
be just as grateful as if someone posts 500 lines of code.

TIA
Marc.
Back to top
Marc Jennings
Guest





Posted: Wed Jan 19, 2005 8:51 pm    Post subject: Re: Simple Q - get the base URL of a portal Reply with quote

Thanks for those, but it is the exact opposite of that that I needed.
However, I have since discovered that you can create a new SPSite
object using the full current url (Page.Request.Url). It was the
createion of a new SPSite object that was one of my goals.

Thanks again, though.
Marc.

On Wed, 19 Jan 2005 13:36:29 +0100, "Info Path" <info@path.com> wrote:

Quote:
Sorry,

See this :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tscSPSite.asp
on the portalUrl property



"Marc Jennings" <MarcJennings@community.nospam> wrote in message
news:h2asu0d9tomoikif034pfgq07gvctpoakj@4ax.com...
Hi there,

Is there a simple method* to return the base URL of the current
portal, wherever you are within the portal, please?

eg. In a webpart on page
http://theportal.example.com/C5/Monkeys/flour.aspx I would like to
know that the base of my portal is http://theportal.example.com/ .

Currently, I have the rather hacky method of

string PortalUrl =
Page.Request.Url.ToString().Replace(Page.Request.RawUrl.ToString(),"/");

but I know it is wildly inelegant, and potentially inaccurate in some
circumstances.

* I am not proud. If someone tells my I can call a simple and well
known parameter/method in one of the standard classes to do this, I'll
be just as grateful as if someone posts 500 lines of code.

TIA
Marc.
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB