M
matt
hello,
i am having trouble doing something. when a user triggers a certain
event in my app, i need to initiate another web request to one of my
other webpages, programmatically. currently, i do this via a WebRequest
-- i attach the default credentials and get the response stream. that
part works. like so:
WebRequest request = HttpWebRequest.Create(reportAspxURL);
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
//Read response to a string
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
string html = sr.ReadToEnd();
//insert html into my PDF-maker
ConvertToPDF(html);
what *doesnt* work, is trying to share user info between the user's
session in my app, and the web request (in this case, to the report
ASPX page). i need to pass some user info into the report-generating
ASPX. i understand that the Session objects cannot be shared, because
WebRequest (presumably) opens a new session.
but what about cookies? elsewhere in my app i use a cookie to store
session info, so when a user goes to a different virtual-directory in
the app, i can pick up their info seamlessly. but when i tried this
technique w/ the above (hitting the report-generating APSX), the .aspx
page cannot seem to find the cookie.
or is there perhaps a better way to do this? since its an
apppage-to-apppage call w/i the same project, can i programmatically
load up the 2nd page, rather than do a WebRequest?
thanks!
matt
i am having trouble doing something. when a user triggers a certain
event in my app, i need to initiate another web request to one of my
other webpages, programmatically. currently, i do this via a WebRequest
-- i attach the default credentials and get the response stream. that
part works. like so:
WebRequest request = HttpWebRequest.Create(reportAspxURL);
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
//Read response to a string
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
string html = sr.ReadToEnd();
//insert html into my PDF-maker
ConvertToPDF(html);
what *doesnt* work, is trying to share user info between the user's
session in my app, and the web request (in this case, to the report
ASPX page). i need to pass some user info into the report-generating
ASPX. i understand that the Session objects cannot be shared, because
WebRequest (presumably) opens a new session.
but what about cookies? elsewhere in my app i use a cookie to store
session info, so when a user goes to a different virtual-directory in
the app, i can pick up their info seamlessly. but when i tried this
technique w/ the above (hitting the report-generating APSX), the .aspx
page cannot seem to find the cookie.
or is there perhaps a better way to do this? since its an
apppage-to-apppage call w/i the same project, can i programmatically
load up the 2nd page, rather than do a WebRequest?
thanks!
matt