storing domain info in web.config, how??

J

Jeff

Hey

ASP.NET 2.0

I'm working on a web site and I want info about the domain stored in
web.config. By domain I mean for example: www.domain.com

The reason I want info about the domain stored is that the web site will
send email to it's registered users. This email will contain a link to a web
page on the web site. If I don't know the domain then I must hard code it...
When developing I can set the domain to localhost and on the final version I
set to www.domain.com (where www.domain.com is just an example) . But I
don't like the idea of hard coding this info.. I would like to change it
without the need for hard coding

So I'm wondering what setting in web.config can I use to store this info? or
do I need to use a custom setting?

Any suggestions?

Jeff
 
G

Guest

Morning Jeff,

Is it separate thread that sends emails from a queue? Or, Do you send emails
directly from a aspx page? in the first scenario, you must define it
somewhere i.e. web.config, In second case you can easly determine it from
current request:

string emailLandinPageUrl = Request.Url.GetComponents(
UriComponents.SchemeAndServer, UriFormat.Unescaped) +
ResolveUrl("~/emailLandingPage.aspx?id=userid");
 
J

Jeff

WOW, thanks for that great tip

Milosz Skalecki said:
Morning Jeff,

Is it separate thread that sends emails from a queue? Or, Do you send
emails
directly from a aspx page? in the first scenario, you must define it
somewhere i.e. web.config, In second case you can easly determine it from
current request:

string emailLandinPageUrl = Request.Url.GetComponents(
UriComponents.SchemeAndServer, UriFormat.Unescaped) +
ResolveUrl("~/emailLandingPage.aspx?id=userid");
 
T

Thomas Hansen

Morning Jeff,

Is it separate thread that sends emails from a queue? Or, Do you send emails
directly from a aspx page? in the first scenario, you must define it
somewhere i.e. web.config, In second case you can easly determine it from
current request:

You can still access it from another thread you just need to pass the
URL as a prameter to the thread startup method...!!

..t
 
G

Guest

Good Evening Thomas,

Of course, but read OP's question again. He asked if there was an autmatic
way of detrmining the full url. You have to define site's URL before passing
to HttpRequest or Uri constructor - right? This is not the case for separate
email-sending thread created by you, because it does not serve the http
request, so there is no HttpContext and you cannot automatically obtain
application full URL using standard asp.net framework API.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top