Ask a Question related to ASP.NET Security, Design and Development.
-
xx #1
Cookies y AxWebBrowser
My problem could no be exactly ASP.NET, but I think this is the best place to
comment it.
I have an ASP.NET page with "Forms" athentication (not Windows).
(this page was already set in our web site, and must be continue as now for
other webclients to use it)
But now, I need an additional WinForms (C#) application, with an ActiveX
AxWebBrowser control to display it.
However, this new win client shouldn't start any new session via Forms
authentication, because it's a already authenticated via Windows.
This is imposible without the correct cookie, isn´t?.
For this reason I've prepared a web service to be invoke by the win client
and get the cookie.
[WebMethod]
public bool Login (string user, string pwd)
{
bool isPersistable = true;
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket (1,
user, DateTime.Now, DateTime.Now.AddMonths(2), isPersistable, string.Empty);
string encryptedTicket = FormsAuthentication.Encrypt (authTicket);
HttpCookie authCookie = new
HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
if (isPersistable)
{
authCookie.Expires = authTicket.Expiration;
}
HttpContext context = this.Context;
context.Response.Cookies.Add(authCookie);
return true;
}
At the client I do the next:
if (myService.Login (user,pwd))
System.Net.Cookie cookie = myService.CookieContainer.GetCookies(new
System.Uri (myService.Url))cookieColl[0]
Until here, ALMOST EVERYTHING go well: I have the cookie at memory, but not
as a file in hard-disk.
Don´t worry, I think, It can be pass by code to the Navigate2 (...,headers)
of the browser control
And here is the second problem: There is no way to pass it in the 'headers'
strHeaders = "Cookie: " + cookie.Name + "=" + cookie.Value + "\r\n";
strHeaders += "Content-Type: application/x-www-form-urlencoded\r\n";
Because 'headers' parameter is an additional headers collection, so if there
was already another previous cookie in it, the mine will be ignored, Won't it?
I´ve checked with a HttpTracer. Because there was this cookie
Cookie: ASP.NET_SessionId=s1pnuh45i3h2dh55rto23bn1
My cookie is not passed.
¿Any idea?????
Thanks.
xx Guest
-
Handling HTML element events using AxWebBrowser
Hello, I am trying to hook into the events for HTML textboxes. In particular the onchange event. In the document complete handler I attach a... -
Help with cookies
I'm having trouble accessing my cookies after they're set. If I do a response.write on the cookie value immediately after it's set in code, it... -
cookies (HELP PLEASE)!!!!!!!!
If this is an urgent problem I would suggest open an incident with Macromedia Product Support.... -
PHP and cookies
ok I have a question maybe this might help if you have $_COOKIE that is a session cookie in path '/' you also have a cookie $_COOKIE that is a... -
cookies under php 4.06
okay, i know this is stupid, and i'm gonna kick myself when someone points out the obvious... i've just put a site online, and found the server's...



Reply With Quote

