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

How to determine the base URL of current page

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
8 1813
"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
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
"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
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
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: Eric Twietmeyer | last post by:
Hello, In playing with a reverse_iterator issue today, I realized that I could use its base() method to get at the underlying iterator. However, I realized that in the implementation shipping...
2
by: NewsAccount | last post by:
Hi I'm trying to find a way to programmatically measure the size of the page sent down to the browser, can't seem to measure the length of what gets written to the HTML TextWriter in protected...
2
by: Sergi Adamchuk | last post by:
I need determine which web service (class WebService or its inheritors) serveces current request (I need Type instance of class that serves request). For example you wrote your own WebService: ...
0
by: Selden McCabe | last post by:
I have a base page class, from which all pages in my project inherit. In the base page prerender event, I would like to know which page is being loaded. But when I do this.ID, it return null. ...
7
by: Doru Roman | last post by:
Hi, What is the fastest way to evaluate manually the result in this case: int a, b, c; a = 255; b = 122; c = a & b; The only way I know is transforming each number into the binary value...
3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the...
7
by: MyndPhlyp | last post by:
I've been combing through Google trying to find the answer but not luck. I'm using Forms authentication. Determining what Roles the current user is in was the easy part (User.IsInRole). But how...
6
by: Alexander Vasilevsky | last post by:
How do you determine (on the client, on the server) that the visitor leave the site? http://www.alvas.net - Audio tools for C# and VB.Net developers
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.