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

storing domain info in web.config, how??

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
Feb 10 '07 #1
5 3727
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");
--
Milosz
"Jeff" wrote:
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
Feb 10 '07 #2
WOW, thanks for that great tip

"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:C3**********************************@microsof t.com...
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");
--
Milosz
"Jeff" wrote:
>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

Feb 10 '07 #3
you can put it in your web.config's <appSettingssection...

<appSettings>
<add key="YourDomainKey" value=www.domain.com/>
</appSettings>

HTH,

Leon

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:OG**************@TK2MSFTNGP03.phx.gbl...
WOW, thanks for that great tip

"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:C3**********************************@microsof t.com...
>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");
--
Milosz
"Jeff" wrote:
>>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


Feb 10 '07 #4
On Feb 10, 11:58 am, Milosz Skalecki [MCAD]
<mily...@DONTLIKESPAMwp.plwrote:
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

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

Feb 11 '07 #5
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
--
Milosz
"Thomas Hansen" wrote:
On Feb 10, 11:58 am, Milosz Skalecki [MCAD]
<mily...@DONTLIKESPAMwp.plwrote:
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

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

Feb 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jim in Arizona | last post by:
I was trying to have an email sent when the page loads but having some trouble with it. Our server is an IIS 6.0 with Framework 2.0. It is set to windows authentication (not anonymous). I...
10
by: Sridhar | last post by:
HI, I am having problems setting up a website so that it will be available only inside the domain. We have three servers. One is iis server and second one is internal server and the third one is...
0
by: Chris Davoli | last post by:
We are changing from using SQL accounts in our connection string to use NT domain accounts. I have found some coe which I am using successfully on my local machine, because the installed account...
9
by: KarlM | last post by:
After reading some articles regarding confuguration data I'm a bit confused. Where is the right place for storing configuration data? - XML-files? - registry? - INI-files? (from a users point...
0
by: Michael Kremser | last post by:
Hi NG! I have troubles with loading an application to its own app domain. I have two applications: An caller application named "OfficeTSWCallerDemo" (in a directory like...
5
by: djc | last post by:
is it still customary to use web.config and global.asax to store connection strings? For example storing the string in web.config and using application start procedure in global.asax to declare a...
6
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm running VS 2003/ASP.NET 1.1.4322.0 on XP SP2 All of a sudden I started to getting... "Error while trying to run project: Unable to start debugging on the web server. Server side-error...
0
by: Sinex | last post by:
Hi, Am writing a webservice thats gonna access a DB and return data. The connection string needs to be configurable. So am thinking of storing it in the web.config file. But then is it a good idea...
11
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.