| Author |
Message |
Marc Jennings
Guest
|
Posted:
Wed Jan 19, 2005 3:56 pm Post subject:
Simple Q - get the base URL of a portal |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
 |
|
|
|
|