Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > storing domain info in web.config, how??

Reply
Thread Tools

storing domain info in web.config, how??

 
 
Jeff
Guest
Posts: n/a
 
      02-10-2007
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      02-10-2007
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
>
>
>

 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      02-10-2007
WOW, thanks for that great tip

"Milosz Skalecki [MCAD]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>>
>>
>>



 
Reply With Quote
 
Leon Tayson
Guest
Posts: n/a
 
      02-10-2007
you can put it in your web.config's <appSettings> section...

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

HTH,

Leon

"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> WOW, thanks for that great tip
>
> "Milosz Skalecki [MCAD]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>>
>>>
>>>

>
>



 
Reply With Quote
 
Thomas Hansen
Guest
Posts: n/a
 
      02-11-2007
On Feb 10, 11:58 am, Milosz Skalecki [MCAD]
<(E-Mail Removed)> wrote:
> 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!

 
Reply With Quote
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      02-11-2007
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]
> <(E-Mail Removed)> wrote:
> > 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!
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a server on one domain the domain controller of a new domain Limited Wisdom MCSA 7 09-13-2006 02:18 AM



Advertisments