Reputation: 13753
I getting a exception to retrieve session value in following condition.
in this situation system throw exception... but if i open site with http://www.example.com then working fine.
I have some questions
Upvotes: 2
Views: 4749
Reputation: 21
In the past many host servers created websites as subdomains under www., following THEN-current naming conventions.
We no longer need to do this.
There are no technical differences you will come across.
What matters is :
This can be done by:
CNAME is the DNS tag that maps an alias to the main name in the DNS record: in this case the "www." version of the name. With this solution surfers could include or exclude www. and reach the site either way.
Making changes in the .htaccess file. Few links for reference:
Upvotes: 2
Reputation: 626
At the end of the day, http://www.domain.com and http://domain.com they are 2 diffrent domain name's if your aiming for a PR of 5 on http://domain.com then obviously don't expect to get it on http://www.domain.com
i do prefer www.
Upvotes: 0
Reputation: 23615
The first is that www is just another subdomain. we're used to type www.example.com, but it is nothing other than ttt.example.com or ppp.example.com
That's why in linux based server you normally have to put your sources in the www directory because it's a subdomain.
for the second there are multiple solutions. Fiddler showd me that when you type http://microsoft.com, microsoft answers with a 301 status (moved permanently) to http://www.microsoft.com
Upvotes: 1
Reputation: 14888
www.
is a subdomain of example.com
. If sessionState is set to use cookies to store the session ID, the domain name can affect sessions as cookies can be bound to domains (and subdomains).
Take a look at Wikipedia's article on cookies.
Upvotes: 1
Reputation: 1786
One option is to create a site in IIS that only serves the purpose of redirecting to the subdomain.
for example you have two sites configured.
www.example.com (main application example.com (configure redirection to http://www.example.com).
Im a bit confused by your question. It looks like your site is posting or redirecting to another site entirely? What duration do you have set for session and what cookie mode are you using?
Upvotes: 1
Reputation: 5209
Putting it very simply, http://site.com and http://www.site.com are two separate sites. This is because of the way DNS is setup for a domain name. You can configure the DNS record for a domain name to point both at the same IP address, or you could use a URLRewrite rule to force traffic one way or the other.
Take a look at this for more info:
Specify a canonical domain name for your site with IIS 7
Upvotes: 4