By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

How to determine the base URL of current page

P: n/a
private string GetSiteUrl()
{
string baseUrl = null;
HttpContext c = HttpContext.Current;
if (c != null)
{
string port = c.Request.ServerVariables["SERVER_PORT"];
if (port == null || port.Equals("80") ||
port.Equals("443"))
port = String.Empty;
else
port = ":" + port;

string protocol =
c.Request.ServerVariables["SERVER_PORT_SECURE"];

if (protocol == null || protocol.Equals("0"))
protocol = "http://";
else
protocol = "https://";

baseUrl = protocol +
c.Request.ServerVariables["SERVER_NAME"] + port +
c.Request.ApplicationPath;
}
return baseUrl;
}

Jun 2 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"Anonieko" <an******@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...

<snip>

So what's the problem...?
--
http://www.markrae.net

Jun 2 '07 #2

P: n/a
Maybe we could all agree that posts which explain a solution to a problem,
whether requested or not, have "FAQ Solution:" in the subject ?

;-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mark Rae" <ma**@markNOSPAMrae.netwrote in message news:uQ**************@TK2MSFTNGP05.phx.gbl...
"Anonieko" <an******@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...

<snip>

So what's the problem...?
--
http://www.markrae.net

Jun 2 '07 #3

P: n/a
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:OD**************@TK2MSFTNGP04.phx.gbl...
Maybe we could all agree that posts which explain a solution to a problem,
whether requested or not, have "FAQ Solution:" in the subject ?

;-)
How many solutions to problems have you accumulated over the years...?

I've got hundreds of 'em... :-)
--
http://www.markrae.net

Jun 2 '07 #4

P: n/a
re:
!How many solutions to problems have you accumulated over the years...?
!I've got hundreds of 'em... :-)

Thousands...but I don't post them unprompted.

;-)

I proposed to a major publisher doing a book with them.
They said no...and 8 months later published a book with the same idea.

:-(

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mark Rae" <ma**@markNOSPAMrae.netwrote in message news:On**************@TK2MSFTNGP05.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:OD**************@TK2MSFTNGP04.phx.gbl...
>Maybe we could all agree that posts which explain a solution to a problem,
whether requested or not, have "FAQ Solution:" in the subject ?

;-)

How many solutions to problems have you accumulated over the years...?

I've got hundreds of 'em... :-)
--
http://www.markrae.net

Jun 2 '07 #5

P: n/a
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
!How many solutions to problems have you accumulated over the years...?
!I've got hundreds of 'em... :-)

Thousands...but I don't post them unprompted.
Exactly.
I proposed to a major publisher doing a book with them.
They said no...and 8 months later published a book with the same idea.
Maybe an "ASP.NET Tips & Tricks" website would be better, although there are
a fair few of those already...
--
http://www.markrae.net

Jun 2 '07 #6

P: n/a
Why look the gift horse in the mouth?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
>!How many solutions to problems have you accumulated over the years...?
!I've got hundreds of 'em... :-)

Thousands...but I don't post them unprompted.

Exactly.
>I proposed to a major publisher doing a book with them.
They said no...and 8 months later published a book with the same idea.

Maybe an "ASP.NET Tips & Tricks" website would be better, although there
are a fair few of those already...
--
http://www.markrae.net

Jun 3 '07 #7

P: n/a
But if i remember i think Juan had a website of something related.
Can't reacll the website URL.
Can you forward it.
Patrick

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:O0**************@TK2MSFTNGP03.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
>!How many solutions to problems have you accumulated over the years...?
!I've got hundreds of 'em... :-)

Thousands...but I don't post them unprompted.

Exactly.
>I proposed to a major publisher doing a book with them.
They said no...and 8 months later published a book with the same idea.

Maybe an "ASP.NET Tips & Tricks" website would be better, although there
are a fair few of those already...
--
http://www.markrae.net

Jun 3 '07 #8

P: n/a
re:
!But if i remember i think Juan had a website of something related.

I worked on http://www.aspnetfaq.com/ for a few months,
when the transition from ASP.NET Beta 2 to the release version was gpoing on.

The site owners were a bit impatient and wanted a major makeover,
but I was a lone developer...and a lot of details were changing very quickly.

The aspnetfaq site is, still, exactly as I left it a few months ago.

I *do* have a FAQ site at my server, but it's not a Q&A site.

It's a guidance site for ASP.NET beginners which, besides offering basic pointers
to where info about ASP.NET can be found, also offers tips on how to manage
interactions in this, and other, ASP.NET newsgroup(s).

That site is : http://asp.net.do/faq/ ...and is in my standard sig.

I'm still mulling over whether a Q & A FAQ site would be a good project.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"rote" <na********@hotmail.comwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl...
But if i remember i think Juan had a website of something related.
Can't reacll the website URL.
Can you forward it.
Patrick

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message news:O0**************@TK2MSFTNGP03.phx.gbl...
>"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
>>!How many solutions to problems have you accumulated over the years...?
!I've got hundreds of 'em... :-)

Thousands...but I don't post them unprompted.

Exactly.
>>I proposed to a major publisher doing a book with them.
They said no...and 8 months later published a book with the same idea.

Maybe an "ASP.NET Tips & Tricks" website would be better, although there are a fair few of those
already...
--
http://www.markrae.net


Jun 4 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.