Hi,
I think the problem is that when you are doing your Post you can't use your
users session. You would actually be creating an entirely new session.
When you redirect to result.aspx you are back to using your users session.
I can't see a way of doing what you are trying to do from the server. With
my ecommerce sites I send my processor the amount of the purchase and a
description (usually an Invoice #). I also send the processor two URLs.
The processor then redirects to one URL upon success and to the other upon
failure. Once that redirection happens the user is back to using their own
session on my site.
All I can think of is after you do your post don't Response.Write the entire
message to the user. Find what you need in it and then just put that in a
label or textbox or cell or something. I post to other sites behind the
scenes all the time to grab information for my user but I don't send back
the entire contents of that response. For one thing it would mess up my
ASP.Net Form tag, for another the content type I get back from my post is
many times not the same content type my user requested my page with in their
browser. There is a very good chance that by doing what you are doing you
are messing up not only your Form tag but also possibly your view state and
if you are using cookieless sessions this could be why you are losing your
session state. I hope this helps. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"Vishal" <anonymous@discussions.microsoft.com> wrote in message
news:0a9701c4ecf2$e30bf930$a501280a@phx.gbl...[color=blue]
> Hi Ken,
>
> here is what happens after the test. If I send the data
> via the post method and do a response.write of the
> reesponse, then there is no session id. If I call the page
> (result.aspx) directly after the purchase has been done,
> then it still has the session ID. So the problem is that
> the response which I got back from the server doesnt know
> or recognize the session id. Can you please help me out
> here?
>
> Thanks in advance
>
>[color=green]
> >-----Original Message-----
> >Hi,
> >
> >Okay, let's narrow this down. In your page load event[/color]
> you are posting to[color=green]
> >your ecommerce server. By the time it gets back to your[/color]
> user they have lost[color=green]
> >their session? I don't see what is happening. Comment[/color]
> out your entire page[color=green]
> >load event and do a response.write(sessionvalue). Do[/color]
> they still have their[color=green]
> >session? If so, process your ecommerce request. But[/color]
> instead of sending[color=green]
> >back everything you receive in your response.writes just[/color]
> do a[color=green]
> >response.write(sessionvalue). If you still have access[/color]
> to the session then[color=green]
> >it is your response.writes that send back the entire[/color]
> response you get from[color=green]
> >the ecommerce server that is causing you the problems.[/color]
> Hopefully someone[color=green]
> >else has experience with this and can just tell you what[/color]
> is wrong. What I[color=green]
> >would like to do is have you start commenting out code[/color]
> until you figure out[color=green]
> >where you are losing the session. Once that is figured[/color]
> out we can come up[color=green]
> >with a solution. Good luck! Ken.
> >
> >--
> >Ken Dopierala Jr.
> >For great ASP.Net web hosting try:
> >
http://www.webhost4life.com/default.asp?refid=Spinlight
> >If you sign up under me and need help, email me.
> >
> >"Vishal" <anonymous@discussions.microsoft.com> wrote in[/color]
> message[color=green]
> >news:2eeb01c4ec91$2aec0360$a401280a@phx.gbl...[color=darkred]
> >> I am using a simple session authentication. User enters
> >> login and pw which I compare with my database. Once he[/color][/color]
> has[color=green][color=darkred]
> >> entered the correct value, I store the userid in the
> >> session object, which indicates that he is logged in.
> >>
> >> Thanks for your interest. Please let me know if you need
> >> any other information. I really need to solve this[/color][/color]
> issue.[color=green][color=darkred]
> >>
> >>
> >>
> >>
> >> >-----Original Message-----
> >> >Hi,
> >> >
> >> >Does your site require your user to login everytime[/color][/color]
> they[color=green][color=darkred]
> >> open a new browser?
> >> >Are you using Forms Authentication? If so then in your
> >> application there is
> >> >a call somewhere to SetAuthCookie(). Set the final
> >> parameter to True:
> >> >
> >> >FormsAuthentication.SetAuthCookie(txtUserName, True)
> >> >
> >> >Now give it a try. Does it work? If so then when[/color][/color]
> your e-[color=green][color=darkred]
> >> commerce server
> >> >passes back to you would need to pass back their
> >> credentials in order to log
> >> >them in. In order to make it more secure you should[/color][/color]
> pass[color=green][color=darkred]
> >> back and ID with
> >> >which you can then retrieve their credentials and re-[/color][/color]
> log[color=green][color=darkred]
> >> them in. I think.
> >> >I'm not exactly sure how things are working. Could[/color][/color]
> post[color=green][color=darkred]
> >> more information?
> >> >From your code it doesn't even appear they are leaving
> >> your server so I
> >> >can't imagine why they are losing Session. This was[/color][/color]
> just[color=green][color=darkred]
> >> a wild guess.
> >> >Good luck! Ken.
> >> >
> >> >--
> >> >Ken Dopierala Jr.
> >> >For great ASP.Net web hosting try:
> >> >
http://www.webhost4life.com/default.asp?refid=Spinlight
> >> >If you sign up under me and need help, email me.
> >> >
> >> >"Vishal" <anonymous@discussions.microsoft.com> wrote in
> >> message
> >> >news:00fc01c4ec7d$6fdf0350$a601280a@phx.gbl...
> >> >> Hello,
> >> >>
> >> >> I already asked this question in the ASP.NET[/color][/color]
> forums,[color=green][color=darkred]
> >> >> but no help came. So I am hoping that somebody can[/color][/color]
> help[color=green][color=darkred]
> >> me
> >> >> out. This is really very URGENT me.
> >> >>
> >> >> For my e-commerce application, I need to send data[/color][/color]
> from[color=green][color=darkred]
> >> my
> >> >> server via the post method to the payment server. The
> >> >> payment server does not run asp.net. I dont know what
> >> they
> >> >> run. The payment server then returns to my server[/color][/color]
> with[color=green][color=darkred]
> >> the
> >> >> result in the qs.
> >> >>
> >> >> Here is the code, which I use to send the data to the
> >> >> server:
> >> >>
> >> >> Private Sub Page_Load(ByVal sender As System.Object,
> >> ByVal
> >> >> e As System.EventArgs) Handles MyBase.Load
> >> >> Dim data() As String =
> >> >> {"name=vishal", "Joined=15May2004", "TotalPosts=112"}
> >> >> PagePipe("http://www.site.com/file.htm",[/color][/color]
> Data)[color=green][color=darkred]
> >> >> End Sub
> >> >> Private Sub PagePipe(ByVal URL As String, ByVal[/color][/color]
> data[color=green][color=darkred]
> >> >> As String())
> >> >> Dim HWR As System.Net.HttpWebRequest
> >> >> Dim sr As System.IO.StreamReader
> >> >> Dim s, sData As String
> >> >> Dim enc As System.Text.ASCIIEncoding
> >> >> Dim b() As Byte
> >> >> ' set up request
> >> >> HWR = System.Net.HttpWebRequest.Create(URL)
> >> >> HWR.Method = "POST"
> >> >> For Each s In data
> >> >> sData += s + "&"
> >> >> Next
> >> >> sData = sData.Trim("&")
> >> >> enc = New System.Text.ASCIIEncoding()
> >> >> b = enc.GetBytes(sData)
> >> >> HWR.ContentType = "application/x-www-form-
> >> >> urlencoded"
> >> >> HWR.ContentLength = b.Length
> >> >> HWR.GetRequestStream().Write(b, 0, b.Length)
> >> >> ' get response
> >> >> Response.Clear()
> >> >> Response.Buffer = False
> >> >> Response.ContentType = HWR.ContentType
> >> >> sr = New System.IO.StreamReader[/color][/color]
> (HWR.GetResponse[color=green][color=darkred]
> >> >> ().GetResponseStream)
> >> >> Response.Write(sr.ReadToEnd)
> >> >> Response.End()
> >> >> End Sub
> >> >>
> >> >> The user must login before he can make any purchase.
> >> Once
> >> >> he has logged in, I store the userid in a session
> >> object.
> >> >> However when I use the above code, then I am somehow
> >> >> loosing the session variable value or it is not
> >> >> recognized. Now the return page is a page, which[/color][/color]
> always[color=green][color=darkred]
> >> >> check at the beginning if the user is logged in or[/color][/color]
> not.[color=green][color=darkred]
> >> >> Unfortunaly now the user is redirected to the[/color][/color]
> login.aspx[color=green][color=darkred]
> >> >> instead of the result.aspx. If I do a response.write[/color][/color]
> for[color=green][color=darkred]
> >> >> the userid then it is empty. Can somebody see why[/color][/color]
> this[color=green][color=darkred]
> >> is
> >> >> happens and how it can be avoided?
> >> >>
> >> >> Thanks in advance
> >> >
> >> >
> >> >.
> >> >[/color]
> >
> >
> >.
> >[/color][/color]