473,747 Members | 2,260 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

launching Browser with cookies

sd
Hello: I have smart client app which needs to access a "forms authentication"
protected website for certain functions. Thre credentials used to login to
smart client are the same as the credentials used to logon to website. Once
the user logs on to the client I do not want them to logon again into the
website.
I guess I have two options
a. Do a screen scraping capturing the view state of the login page and
establish the session by storing the cookies.
b. Create a webservice to logon and store the cookies and then call the urls
from a webbrowser.

Option "b" was better and so I wouldl want to proceed in this direction.

Since I would like to render html in a browser instantiated from the smart
client I cannot use standard managed classes like webclient, webresponse etc
and
need to depend on unmanaged code using shdocvw and axwebbrowser.

Now the challenge is how do I pass cookies stored in a cookiecontainer to
the Navigate or Navigate2 methods as headers so that I can access a
protected site and use the same session.
Nov 17 '05 #1
6 2422
sd,

Just to let you know, what you are describing is not a smart client.
From what I can read, it is just a web application.

And it seems like the entire application is an HTML one, so what are you
trying to do with the screen scraping and whatnot? It doesn't make much
sense.

Why not expose your functionality through web services, and then have
the smart client make calls to the web services? You can layer
authentication on top of that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"sd" <sd@discussions .microsoft.com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
Hello: I have smart client app which needs to access a "forms
authentication"
protected website for certain functions. Thre credentials used to login to
smart client are the same as the credentials used to logon to website.
Once
the user logs on to the client I do not want them to logon again into the
website.
I guess I have two options
a. Do a screen scraping capturing the view state of the login page and
establish the session by storing the cookies.
b. Create a webservice to logon and store the cookies and then call the
urls
from a webbrowser.

Option "b" was better and so I wouldl want to proceed in this direction.

Since I would like to render html in a browser instantiated from the smart
client I cannot use standard managed classes like webclient, webresponse
etc
and
need to depend on unmanaged code using shdocvw and axwebbrowser.

Now the challenge is how do I pass cookies stored in a cookiecontainer to
the Navigate or Navigate2 methods as headers so that I can access a
protected site and use the same session.

Nov 17 '05 #2
Thank you very much.

"sd" wrote:
Hello: I have smart client app which needs to access a "forms authentication"
protected website for certain functions. Thre credentials used to login to
smart client are the same as the credentials used to logon to website. Once
the user logs on to the client I do not want them to logon again into the
website.
I guess I have two options
a. Do a screen scraping capturing the view state of the login page and
establish the session by storing the cookies.
b. Create a webservice to logon and store the cookies and then call the urls
from a webbrowser.

Option "b" was better and so I wouldl want to proceed in this direction.

Since I would like to render html in a browser instantiated from the smart
client I cannot use standard managed classes like webclient, webresponse etc
and
need to depend on unmanaged code using shdocvw and axwebbrowser.

Now the challenge is how do I pass cookies stored in a cookiecontainer to
the Navigate or Navigate2 methods as headers so that I can access a
protected site and use the same session.

Nov 17 '05 #3
sd
Thx for the reply, but your guess is way off the target. In my case a smart
client is being used for data entry however extensive reporting is being done
only thru webforms on the website. Since tha data is shared by multiple smart
clients, and a ultra thin interface(asp.n et) is also being developed which
is being used only for reports. The smart client does communicate thru
webservices for data sync, however there is absolutely no justification in
developing reports in multiple places i.e. winforms as well as webforms and
hence this query.

As mentioned in my previous post when the user logs on to the app, he is
authenticated thru webservices and data is synced, but when he would want to
run the reports I would like to redirect him to a website.

sd.
"Nicholas Paldino [.NET/C# MVP]" wrote:
sd,

Just to let you know, what you are describing is not a smart client.
From what I can read, it is just a web application.

And it seems like the entire application is an HTML one, so what are you
trying to do with the screen scraping and whatnot? It doesn't make much
sense.

Why not expose your functionality through web services, and then have
the smart client make calls to the web services? You can layer
authentication on top of that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"sd" <sd@discussions .microsoft.com> wrote in message
news:E2******** *************** ***********@mic rosoft.com...
Hello: I have smart client app which needs to access a "forms
authentication"
protected website for certain functions. Thre credentials used to login to
smart client are the same as the credentials used to logon to website.
Once
the user logs on to the client I do not want them to logon again into the
website.
I guess I have two options
a. Do a screen scraping capturing the view state of the login page and
establish the session by storing the cookies.
b. Create a webservice to logon and store the cookies and then call the
urls
from a webbrowser.

Option "b" was better and so I wouldl want to proceed in this direction.

Since I would like to render html in a browser instantiated from the smart
client I cannot use standard managed classes like webclient, webresponse
etc
and
need to depend on unmanaged code using shdocvw and axwebbrowser.

Now the challenge is how do I pass cookies stored in a cookiecontainer to
the Navigate or Navigate2 methods as headers so that I can access a
protected site and use the same session.


Nov 17 '05 #4
Hi sd,

I'm facing the exact same issue. I have a C# client which communicates
primarily with a web service for data and authentication. But I also
have previously developed ASP.NET material which I want to use by
pulling up
an AxWebBrowser, and I don't want my client to have to login again.
Have you found a way to put cookies into these components so that
Sessions are shared between the smart client and the web material?
If not, I will continue to look and let you know if I find a solution.

Thanks,
Harold
Primary Global Research, LLC

Nov 17 '05 #5
Why are you using the AxWebBrowser? Why not use the .NET WebRequest
class to make a web request? It supports various authentication as well
as the ability to persist cookies in a CookieCollectio n.

I don't have an example readily available, but I'm sure if you search
for: WebRequest, CookieCollectio n, and C#

You can find some good stuff!
=Shane DeSeranno

hs****@gmail.co m wrote:
Hi sd,

I'm facing the exact same issue. I have a C# client which communicates
primarily with a web service for data and authentication. But I also
have previously developed ASP.NET material which I want to use by
pulling up
an AxWebBrowser, and I don't want my client to have to login again.
Have you found a way to put cookies into these components so that
Sessions are shared between the smart client and the web material?
If not, I will continue to look and let you know if I find a solution.

Thanks,
Harold
Primary Global Research, LLC

Nov 17 '05 #6
Hi Shane,

You're exactly right, I have looked at the HTTPRequest and it seems
like it would be easy to attach cookies to it. I can certainly do this
for the initial request. However, I'm using the browser for two
things, I guess:

1) to render the returned HTML;
2) the returned page will have links on it; I'd have to trap the
link clicked event so that I can always make a cookie-laden HTTPRequest
on the browser's behalf. I'm not sure if this is possible (it may very
well be, I'm just not that familiar with the AxWebBrowser event API).

So I thought it would be easiest just to store the cookies in the
browser and have it handle everything itself.

Harold

Nov 17 '05 #7

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

Similar topics

2
4713
by: Tom | last post by:
Hi, I would like to use the standard PHP sessions and I understand they rely on the target web browser to support session cookies. I have tried the following code: <? session_start(); if (!session_id()) { //no support for session
3
1853
by: Richard P | last post by:
I am experiencing some browser weirdness. My app uses session state to hide values I prefer to keep out of the querystring. I am testing to see what happens when cookies are fully disabled in IE 6 and NS 7. NS behaves as expected: it has no recall of previous requests. With IE however my app works as normal: I can still store and retrieve values from session state. Am I imagining this? If not it suggests to me that IE 6 always includes a...
5
3176
by: David Baker | last post by:
Hi all I am very new to ASP.Net. I am trying to create a sniffer for our program. We want our users to click our sniffer and hopefully the sniffer will check their computer against our requirements. I would like to ask experts like you to see which items are actually doable with ASP.Net. Below I listed all of the items we are looking for but I can understand if some of the items are impossible to check/sniff. We would like to create a sniffer...
9
3060
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET application, how can we code the project to check to make sure the browser accepts cookies? 2. Where would we put this code? In Global.asax? 3. Using C# in an ASP.NET application, how can we code the project to detect and make sure the browser...
2
1240
by: Prasad Dannani | last post by:
Hi, I want to know the browser settings like Image Enabled, Cookie Enabled etc., For Cookies and Script Request object has some properties but after disabling certain features also we are getting the same results. Please help on the way of tracking the image disabled option ASAP.
24
2088
by: Alan M Dunsmuir | last post by:
What is the command (in Windows Forms VB.NET) which will cause the subject computer's default browser to launch, and display a specified Web page? -- Alan M Dunsmuir
0
541
by: dawson | last post by:
I started off by trying to use the HttpCapabilitiesBase.Cookies Property (Note: This property is new in the .NET Framework version 2.0) however it kept on returning true even when I disabled cookies in both FireFox and Internet Explorer. After a bit of googling I found that a lot of people were creating cookies, then re-reading them; obviously if they could re-read the cookie then they knew that the client's browser accepts cookies!...
24
2471
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I see in javascript if a web browser accepts cookies? ----------------------------------------------------------------------- Writing a cookie, reading it back and checking if it's the same. http://www.w3schools.com/js/js_cookies.asp Additional Notes:
3
7788
by: =?Utf-8?B?Qkw=?= | last post by:
if (Request.Browser.Cookies) { // Cookies supported } else { // Web browser not supports cookies }
0
8979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8818
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9522
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9307
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8234
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4589
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.