C# - Share Cookies Accross 2 Domains In .net?

Mar 23, 2010

Trying to share cookies accross 2 domains in asp.net, for some reason 1 domain has a '.' before the domain, and the other doesn't.

Why is that? e.g:

.staging.example.com

and

staging.example.com

Is this something to do with how I create the cookie, or a web.config change?I am not using forms authentication, just creating a cookie manually.

I am setting the cookie domain like:

HttpCookie c = new HttpCookie("blah");
c.Value = "123";
c.Expires = DateTime.Now.AddHours(12);
c.Domain = ".staging.example.com";

Response.Cookies.Add(c);

For some reason not getting the '.' in the cookie.

View 3 Replies


Similar Messages:

Cookies Over Multiple Sub Domains Except One?

Apr 21, 2010

So I know you can share your cookies across subdomains eg. staging.mysite.com and www.mysite.com etc by setting the domain of the cookies to ".mysite.com"

BUT, is there a way to share across all the sub domains EXCEPT one. e.g. the cookies will not persist on images.mysite.com?

View 1 Replies

Sharing Cookies Across Different Domains And Different Applications?

Jan 24, 2011

Is there a way to share cookies across different domains and different applications (classic ASP and ASP.NET)

View 4 Replies

Security :: Transferring Cookies Between Pages With Different Domains?

Apr 20, 2010

read a cookie of a site with a different domain? I am currently trying to avoid an extra of step of logging into a website that I am currently developing.

View 1 Replies

JQuery :: Move The Div Tag Accross The Image?

Dec 15, 2010

I am working on some document management system, in that user need to do comments on the image, i have div tag with textbox control, i want that div tag like mobavle. Also, they want to do singing / stamping over the image.i am planing use draggable div tag with image control.is it possible to move the div accross the image?if scroll bar(vertical & horizontal) comes what will happen? how to get the dragged co-ordinates after the drag?

View 1 Replies

Cookies - How To Share A Function That Uses "Response" Or "Request"

Jan 5, 2011

I'd like to have a utility function that conditionally updates my request and response across several pages in my site.

Using a standard .CS class doesn't seem to give me access to these objects. How can I (generall speaking) create a utility function that checks for a cookie and update it across multiple pages?

View 4 Replies

MVC :: 3 Applying Trim Accross The Every Properties In The Model?

Mar 22, 2011

how can i apply string.trim() accross the website when saving or editting data on the model rather then on individual fields accross the site in the controller.

View 2 Replies

Web Forms :: How To Include Share Icons And Share Options To Site

Jun 10, 2010

I need a code to have the ability to share my news on social networks.My site structure is in Asp.net and vb.net.

View 1 Replies

Social Networking :: Share Images On Facebook Using Share Button

Jun 29, 2013

I am showing thumbnail images in dataList on a page of my website. When i click on any image they open in big size. How i will share(Facebook). that particular big size image. My code is given below:

<script type="text/javascript">
var CurrentPage = 1;
function GetImageIndex(obj) {
while (obj.parentNode.tagName != "TD")
obj = obj.parentNode;
var td = obj.parentNode;

[CODE]..

View 1 Replies

Javascript - How To Get And Set Cookies / Getting Different Values For The Cookies In Different Pages?

Aug 17, 2010

I'm handling cookies using JavaScript to store some values in my asp.net web application.I use document.cookie to save some values (converted into a lengthy string). But i want that value to be accessible across all the pages in my application.When i try to get that value from a different page, i get the values pertaining to the document in the current URL.

In short i save the value in the cookie in http://myapp/doc1.aspx and want to retrieve it in http://myapp/doc2.aspx

So is document.cookie is pertaining to a single document scope? How can i save/read cookies across the site?

Update.This is how i get and set cookies

function getCookie(c_name)
{
try{ [code]...

But i'm getting different values for the cookies in different pages.

View 2 Replies

File.OpenRead() Accesses File On Share Within Workgroup But Not A Remote Share?

Mar 4, 2011

I have an ASP.NET MVC application that attempts to read a file in using a filestream and File.OpenRead().
When the path to the file is a share on the same workgroup, and I give access to NETWORK SERVICE for the share, this works perfectly as desired.

However, when the path to the share is a UNC path to a remote share within the LAN, with read permissions open for "Everyone", the "File.OpenRead()" method throws an exception saying "Could not find a part of the path".

In my test cases I'm debugging locally with the ASP.NET MVC app being given a UNC path to the computer that it's actually running on. It's a share on my C drive, being "Shared" with permissions to "Everyone" for read access.

Is there something in IIS that needs to be configured? If I try to impersonate, in this context, the impersonation doesn't matter because NETWORK SERVICE was the user trying to access the files when it worked for a share in the same workgroup.

View 2 Replies

Relationship Between HttpContext.Request.Cookies And HttpContext.Response.Cookies

Nov 23, 2010

I have been experimenting with code that will clear all of the cookies in an HttpContext.Response.Initially, I used this:

DateTime cookieExpires = DateTime.Now.AddDays(-1);
for (int i = 0; i < HttpContext.Request.Cookies.Count; i++)
{
HttpContext.Response.Cookies.Add(
new HttpCookie(HttpContext.Request.Cookies[i].Name, null) { Expires = cookieExpires });
}

this will error with an OutOfMemoryException because the for loop never exits - each time you add a cookie to the Response, it also gets added to the `Request.

View 1 Replies

Does The Request.Cookies Collection Get Copied To The Response.Cookies Collection

Apr 1, 2011

I know that if I have set a cookie on a previous request, it will show up in my Request.Cookies collection. I want to update my existing Cookie. Are the cookies from my Request.Cookies collection already copied to my Response.Cookies collection? Do I need to add a new cookie with the same key using Response.Cookies.Add(), or do I need to use Response.Cookies.Set()?

View 1 Replies

Using AD To Authenticate To Different Domains?

Aug 2, 2010

So we have been using the same login gode to connect to various domains in asp.net, with and without MVC. The code works. We have a new server, first one to run server 2008 r2, set up with a directory structure similar to one of the ones that has been working. Using forms authentication, I set up in the web.config

<add name="ADConnectionString" connectionString="LDAP://10.1.XXX.XXX"/>
and
<!--<authentication mode="Windows" />-->
<membership defaultProvider="MyADMembershipProvider" >
<providers >
<add name="MyADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADConnectionString"
connectionUsername="XXXXBrown.Eric"
connectionPassword="XXXX"
connectionProtection="None"
/>
</providers>
</membership>

It connects to build the membership provider just fine, but when I tryto use the exact same username and password to login on the forms login page (the stock asp.net stuff) it fails to login. same user, same password that's being used to connect with the membership provider. If I change the password in the web.config, I get an error that it's incorrect, so I know that the membership provider is getting connected with those credentials. What I can't figure out is why can't I use the same credentials to login? I've checked:

The user is not locked.

the user is not set to change password on next logon.

The user is not expired.

View 1 Replies

How To Redirect Different Domains To Website

Jun 15, 2010

I want to redirect different domains which I have to my newly created website using dotnetnuke. As it is currently working on this site [URL](when user type thescripts.com it redirects user to [URL]

View 2 Replies

Different Domains Point To Different Project?

Feb 26, 2011

Question, I have a few asp.net c# projects... but I only use one webhosting to host all the projects. My question is,

Is it possible for me to register like 2 domains and point each domain to 2 projects within that web host?

For example:

Http://mysite1.com will point to the "../project1/default.aspx"
http://mysite2.com will point to the "../project2/default.aspx"

View 7 Replies

Robots.txt With One Site But Two Domains?

May 6, 2010

I have a website which has two domains added. Both domains point to the root of the website. Is it possible to alter the robots.txt so that one of the domains doesn't get crawled, while the other still does?

View 1 Replies

Sharing Authentication On Different Apps On Different Sub - Domains

Jan 19, 2011

I have 2 applications. One on asp.net webforms [URL] which should provide authentication, user logs in and I can use the cookie to authenticate on my asp.net mvc app located at [URL]. All I'd like to do is able to access the cookie so I can get the userId that was stored in it using the FormsAuthentication.

They use normal authentication provided by microsoft;

<authentication mode="Forms">
<forms domain="test.com" loginUrl="Default.aspx" protection="All" path="/" requireSSL="false" timeout="45" name=".ASPXAUTH" slidingExpiration="true" defaultUrl="Default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
</authentication>

This cookie should be accessible to any submain on [URL] right?

View 2 Replies

Iis - One Application, Different Domains: How To Preserve Sessions

Mar 18, 2010

I have an application with different sections. Each section is accessed through a domain. Example:

[URL] I need to preserve the session when the user navigates from one to another URL. The application is the same in IIS. How to accomplish that?

View 5 Replies

Web Forms :: Multiple Applications In Different Domains?

Mar 24, 2011

I have several applications in different domains with the same code, how feasible that through the admin domain [URL] read the file. aspx.

If I upgrade an application, I copied every current updates on all domains.

I could use to copy the file only once on the server [URL] and in all domains, the update fixes.

View 2 Replies

Security :: Single Sign On Different Domains?

Oct 13, 2010

I have a web app located at [URL] and I have several domains, such as [URL], [URL], etc. all pointing to the same directory in IIS. I use Host Headers to acheive this by setting the 'Host Header Values' under properties for the main site (under the Web site identification section). Based on the host header value I perform different functions in my pages.

Because of the way I have it set up, all the domains share the same files, web.config, etc. I have set the 'machinekey' in my web.config and have forms authemtication. However, when I go to MyMainSite.com and log in and then the user clicks a link and gets directed to MyFirstSite.com the user is shown as logged out. I need the user to be logged in and I need to be able to access the logged in user profile to display certain information. I thought by setting the 'machinekey', i could acheive this, but it does not seem to work.

how to go about having a single log on for my users?

The articles I have found show the same domain or have different domains each with a different web.config. The way they describe does not seem to work for me.

View 1 Replies

Configuration :: Handling Two Domains Using One Website?

Dec 2, 2010

I'm trying to handle two domains using one IIS site, the reason to save money on web hosting so I would like to know if that's possible.

I'm using IIS Windows 2008 R2 + .Net 4

View 3 Replies

MVC :: Multiple Domains In Single Application

Aug 25, 2010

I want to use my asp.net mvc application with multiple domains (maybe of hundreds),

so I have created custom Route class that matches requests including domain.

Each domain could has different routes, so the number of routes in RouteTable can be huge

(eg 500 domains, each 20 routes = 10000 routes in RouteTable).

I am considering how it will be efficient?

I have an idea to replace RouteTable.Routes (of type RouteCollection)

with custom one (of type Dictionary<string, RouteCollection>).

But how I can override default route matching mechanism with my custom mechanism which will be two step:

1) retrieve RouteCollection from dictionary based on domain name

2) retrieve specyfic Route object (standard route matching mechanism)

How can I do this?

View 4 Replies

Setup Sub Domains In Development Environment?

Jun 13, 2010

I would like to know the method of setting up sub-domains in the development environment. Don't have any hosting account yet. But would like to test it up internally by simulating a similar setup that would be provided by the hosting company later on.

View 3 Replies

Can't Allow Integrated Windows Authentication *for One Of Domains*

May 13, 2010

We have an ASP.NET web application which uses integrated windows authentication. It is accessed by users from two domains, A and B. A is the primary domain and B is an older domain which is going away. Web application is authenticating users using a group policy which only exists in domain A. Every user in domain B has an account in domain A. The application lives in domain A. There was no trust between the domains. So users from domain A would get silently authenticated and logged into the site. Users from domain B didn't get authenticated automatically and were prompted with the IE popup, to which they authenticated using their domain A credentials and everything worked. Now somebody has set up a trust between the domains and users from domain B get authenticated silently to IIS, and then their login fails (no group policy). So the question is:

can I either programmatically or in IIS configuration make it so that users from domain B still get prompted even though there is trust between the domains? Is there a way to tell the server where IIS is running to ignore the trust relationship maybe?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved