Dropped Sessions?

D

Davej

I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.

WebClient keeps returning the VS and EV but they aren't changing.

In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?

Thanks
 
A

Arne Vajhøj

I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.

WebClient keeps returning the VS and EV but they aren't changing.

And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?

ViewState is page scope and is stored client side.

You can do something similar in JSF.

If you control the ASP.NET side, then you could disable
view state.

Arne
 
D

Davej

I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.

And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?

ViewState is page scope and is stored client side.

You can do something similar in JSF.

If you control the ASP.NET side, then you could disable
view state.

Arne

Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
 
A

Arne Vajhøj

I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.

And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?

ViewState is page scope and is stored client side.

You can do something similar in JSF.

If you control the ASP.NET side, then you could disable
view state.

Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.

ASP.NET gives you a cookie that identifies the session.

When you send that with the following requests, then you
get the correct Session object associated with the request.

ViewState stores the page context which is different.

Arne
 
D

Davej

On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?
ViewState is page scope and is stored client side.
You can do something similar in JSF.
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.

ASP.NET gives you a cookie that identifies the session.

When you send that with the following requests, then you
get the correct Session object associated with the request.

ViewState stores the page context which is different.

Arne

Oh heck, Session is a cookie. I thought it was part of the VS or EV.

http://msdn.microsoft.com/en-us/library/ms178582.aspx
 
D

Davej

On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?
ViewState is page scope and is stored client side.
You can do something similar in JSF.
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.

ASP.NET gives you a cookie that identifies the session.

When you send that with the following requests, then you
get the correct Session object associated with the request.

ViewState stores the page context which is different.

Arne

NameValueCollection NameValPairs = new NameValueCollection();

NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);

m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);

So is there (hopefully) something simple like
AddCookie("SessionState")

???
I don't see it.
 
A

Arne Vajhøj

On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?
ViewState is page scope and is stored client side.
You can do something similar in JSF.
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.

ASP.NET gives you a cookie that identifies the session.

When you send that with the following requests, then you
get the correct Session object associated with the request.

ViewState stores the page context which is different.

Oh heck, Session is a cookie. I thought it was part of the VS or EV.

It is not.

You need a CookieContainer.

That is easy in HttpWebRequest, but seems to require
a hack in WebClient.

http://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class

Arne
 
A

Arne Vajhøj

On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?
ViewState is page scope and is stored client side.
You can do something similar in JSF.
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.

ASP.NET gives you a cookie that identifies the session.

When you send that with the following requests, then you
get the correct Session object associated with the request.

ViewState stores the page context which is different.

Arne

NameValueCollection NameValPairs = new NameValueCollection();

NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);

m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);

So is there (hopefully) something simple like
AddCookie("SessionState")

???
I don't see it.

See SO link in my previous post on how to work around it.

Arne
 
D

Davej

On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie? [....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.

NameValueCollection NameValPairs = new NameValueCollection();

NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);

m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);

So is there (hopefully) something simple like
AddCookie("SessionState")

???
I don't see it.

Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head. Thanks.



public class CookieAwareWebClient : WebClient
{
private readonly CookieContainer m_container = new
CookieContainer();

protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
HttpWebRequest webRequest = request as HttpWebRequest;
if (webRequest != null)
{
webRequest.CookieContainer = m_container;
}
return request;
}
}
 
D

Davej

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
In Java you have response objects and session objects but I'm getting
confused about what VS and EV are representing and how ASP.NET may
differ. I don't need to keep setting session objects in ASP do I?
ViewState is page scope and is stored client side.
You can do something similar in JSF.
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
Oh heck, Session is a cookie. I thought it was part of the VS or EV.

It is not.

You need a CookieContainer.

That is easy in HttpWebRequest, but seems to require
a hack in WebClient.

http://stackoverflow.com/questions/1777221/using-cookiecontainer-with...

Arne

CookieAwareWebClient m_client = new CookieAwareWebClient();

Uri serviceUri = new Uri("http://www.myspot.com/service.aspx");
WebRequest wr = WebRequest.Create(serviceUri);

NameValueCollection NameValPairs = new NameValueCollection();

NameValPairs.Add("form1", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);

// m_client.Headers.Add("???", HttpContext.Current.Session.SessionID);
// m_client.Headers.Add(HttpRequestHeader.Cookie,
m_client.Headers.???);

m_pageBuffer = m_client.UploadValues(serviceUri, "POST",
NameValPairs);

???????
 
A

Arne Vajhøj

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie? [....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.

NameValueCollection NameValPairs = new NameValueCollection();

NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);

m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);

So is there (hopefully) something simple like
AddCookie("SessionState")

???
I don't see it.

Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.

Nothing. Just use the same instance for all requests.

Arne
 
D

Davej

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
Arne
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.

Nothing. Just use the same instance for all requests.

Arne

Just use it? No add-cookie-to-the-header-collection first? No
WebRequest object?
 
A

Arne Vajhøj

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.

Nothing. Just use the same instance for all requests.

Just use it? No add-cookie-to-the-header-collection first? No
WebRequest object?

Yes. No. No.

When you use that CookieAwareWebClient then its HttpWebRequest
get associated a CookieContainer and then sessions should
work.

Arne
 
D

Davej

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
Arne
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.

Nothing. Just use the same instance for all requests.

Arne

Hmmm... just substituting CookieAwareWebClient does not seem to
produce different results. It supports cookies, but will it both
receive and send them without help?

I download the login page.
submit name & pwd.
I see that I have been redirected to the logged-in page.
I post to the logged-in page and get what looks like a legitimate
result.
I post to the logged-in page a second time and EV and VS do not
change. I think that means my session variable has not been found.
 
A

Arne Vajhøj

On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.

Nothing. Just use the same instance for all requests.
Hmmm... just substituting CookieAwareWebClient does not seem to
produce different results. It supports cookies, but will it both
receive and send them without help?

It should.
I download the login page.
submit name& pwd.
I see that I have been redirected to the logged-in page.
I post to the logged-in page and get what looks like a legitimate
result.
I post to the logged-in page a second time and EV and VS do not
change. I think that means my session variable has not been found.

Maybe - maybe not.

Aren't there a more specific way to check if you are logged in or not?

Arne
 
D

Davej

On 5/5/2012 2:50 PM, Davej wrote:
On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right. I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing..
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.
Nothing. Just use the same instance for all requests.
Hmmm... just substituting CookieAwareWebClient does not seem to
produce different results. It supports cookies, but will it both
receive and send them without help?

It should.
I download the login page.
submit name&  pwd.
I see that I have been redirected to the logged-in page.
I post to the logged-in page and get what looks like a legitimate
result.
I post to the logged-in page a second time and EV and VS do not
change. I think that means my session variable has not been found.

Maybe - maybe not.

Aren't there a more specific way to check if you are logged in or not?

Arne

You are right that I am making this problem more difficult and
mysterious for myself by not consistently sending complete debug
information back from the website. Actually..... it may be working
now!!!
 
D

Davej

On 5/5/2012 2:50 PM, Davej wrote:
On 5/5/2012 11:57 AM, Davej wrote:
On 5/5/2012 11:34 AM, Davej wrote:
I thought I had WebClient working, but it isn't working right.I
establish a session with Session["sessname"] = myid and use
Response.Redirect("newpage") and I keep returning the hidden
"__VIEWSTATE" and "__EVENTVALIDATION" fields, but my session dies
immediately.
WebClient keeps returning the VS and EV but they aren't changing.
And you are also returning the right session cookie?
[....]
If you control the ASP.NET side, then you could disable
view state.
Cookies? Does Session[] create a cookie? I am just extracting and
returning the VS and EV strings. Thanks.
ASP.NET gives you a cookie that identifies the session.
When you send that with the following requests, then you
get the correct Session object associated with the request.
ViewState stores the page context which is different.
NameValueCollection NameValPairs = new NameValueCollection();
NameValPairs.Add("form2", "");
NameValPairs.Add("__VIEWSTATE", m_strVS);
NameValPairs.Add("__EVENTVALIDATION", m_strEV);
NameValPairs.Add("Input", update);
m_pageBuffer = m_client.UploadValues(uriString, "POST", NameValPairs);
So is there (hopefully) something simple like
AddCookie("SessionState")
???
I don't see it.
Oh, so if I use an instance of a CookieAwareWebClient what do I
actually have to do to make it work? Declare the address of the page
as a Uri and then call GetWebRequest before using the WebClient? This
stuff is over my head.
Nothing. Just use the same instance for all requests.
Hmmm... just substituting CookieAwareWebClient does not seem to
produce different results. It supports cookies, but will it both
receive and send them without help?
It should.
Maybe - maybe not.
Aren't there a more specific way to check if you are logged in or not?

You are right that I am making this problem more difficult and
mysterious for myself by not consistently sending complete debug
information back from the website. Actually..... it may be working
now!!!

Ah, it is working until I throw some sort of exception reading the
database with SqlDataReader or improperly passing the result array
back. At that point everything dies -- including the sessions.

Thanks for your help!!!
 
A

Arne Vajhøj

Ah, it is working until I throw some sort of exception reading the
database with SqlDataReader or improperly passing the result array
back. At that point everything dies -- including the sessions.

The session should not be invalidated due to an exception.

But obviously you need to handle the exception properly.

Would it be possible to expose the data as a web service
instead of as a web page (that would make many things
easier client side)?

Arne
 
D

Davej

On 5/6/2012 9:19 PM, Davej wrote:
[...]
Ah, it is working until I throw some sort of exception reading the
database with SqlDataReader or improperly passing the result array
back. At that point everything dies -- including the sessions.

The session should not be invalidated due to an exception.

But obviously you need to handle the exception properly.

Would it be possible to expose the data as a web service
instead of as a web page (that would make many things
easier client side)?

Arne

I was confused by web services so I went down the path of "screen
scraping" with the idea that I could perhaps switch over later.

I have a couple of database-related subroutine calls commented out
right now because they seem to make everything die.
 
A

Arne Vajhøj

On 5/6/2012 9:19 PM, Davej wrote:
[...]
Ah, it is working until I throw some sort of exception reading the
database with SqlDataReader or improperly passing the result array
back. At that point everything dies -- including the sessions.

The session should not be invalidated due to an exception.

But obviously you need to handle the exception properly.

Would it be possible to expose the data as a web service
instead of as a web page (that would make many things
easier client side)?

I was confused by web services so I went down the path of "screen
scraping" with the idea that I could perhaps switch over later.

I think it would have been way easier for you with web services.

WCF is a bit complex, but there are alternatives:
* oldfashioned .asmx web services
* a simple web handler (.ashx)

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top