I have a site that goes through a login process. Once logged in, you can then go to a specific page.
I can log into the site using a POST and then nagivate to the page, but the page has references to images etc on the site, so the page is incomplete and unusable.
I have tried logging on to the site using System.Net.WebRequest.Create(url) and then copying the cookies from System.Net.Cookies to System.Web.HttpCookie and copying the "Set-Cookie" from the header. Followed by a context.response.redirect(<site>). But the site comes back with session expired.
Have tried dynamic forms, but dont know how to keep control.
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head>");
System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, Method, Url));
for (int i = 0; i < oNameCollection.Keys.Count; i++)
{
System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">",
oNameCollection.Keys, oNameCollection[oNameCollection.Keys]));
}
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");
System.Web.HttpContext.Current.Response.End();
}
I can log into the site using a POST and then nagivate to the page, but the page has references to images etc on the site, so the page is incomplete and unusable.
I have tried logging on to the site using System.Net.WebRequest.Create(url) and then copying the cookies from System.Net.Cookies to System.Web.HttpCookie and copying the "Set-Cookie" from the header. Followed by a context.response.redirect(<site>). But the site comes back with session expired.
Have tried dynamic forms, but dont know how to keep control.
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head>");
System.Web.HttpContext.Current.Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
System.Web.HttpContext.Current.Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, Method, Url));
for (int i = 0; i < oNameCollection.Keys.Count; i++)
{
System.Web.HttpContext.Current.Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">",
oNameCollection.Keys, oNameCollection[oNameCollection.Keys]));
}
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");
System.Web.HttpContext.Current.Response.End();
}