I keep getting the following error message: error BC30311: Value of type 'System.Web.HttpRequest' cannot be converted to 'System.Net.WebRequest'. objRequest = HttpContext.Current.Request '(CType(HttpContext.Current.Request, HttpWebRequest))
Jason N. Gaylord
ASPInsider and Microsoft MVP
http://jasongaylord.com
Jason, HttpContext.Current.Request is of type System.Web.HttpRequest, not of type System.Net.HttpWebRequest, so that can't be done. Why do you want to convert it to that?
Well, I found a way around what I needed to accomplish. I had a bad brain blockage this week. I was attempting to do this:Dim objRequest as HttpWebRequest Dim stmOutput as StreamReader objRequest = (CType(HttpContext.Current.Request, HttpWebRequest))
stmOutput = New StreamReader(objRequest.GetRequestStream(),System.Text.Encoding.ASCII)I then realized I didn't have to do that. So, to get my Stream, I just grabbed the InputStream like this:Dim stmOutput as StreamReader stmOutput = New StreamReader(HttpContext.Current.Request.InputStream)Thanks
to Ben for forcing me to think this through. ;)
Jason N. Gaylord
ASPInsider and Microsoft MVP
http://jasongaylord.com
Member
87 Points
683 Posts
ASPInsiders
MVP
Converting HttpContext.Current.Request to HttpWebRequest
Jul 13, 2004 09:01 AM|j_gaylord|LINK
ASPInsider and Microsoft MVP
http://jasongaylord.com
Member
87 Points
683 Posts
ASPInsiders
MVP
Re: Converting HttpContext.Current.Request to HttpWebRequest
Jul 13, 2004 11:31 AM|j_gaylord|LINK
error BC30311: Value of type 'System.Web.HttpRequest' cannot be converted to 'System.Net.WebRequest'. objRequest = HttpContext.Current.Request '(CType(HttpContext.Current.Request, HttpWebRequest))
ASPInsider and Microsoft MVP
http://jasongaylord.com
Member
30 Points
851 Posts
Re: Converting HttpContext.Current.Request to HttpWebRequest
Jul 14, 2004 11:12 PM|tomasr|LINK
tomasr@mvps.org
Member
87 Points
683 Posts
ASPInsiders
MVP
Re: Converting HttpContext.Current.Request to HttpWebRequest
Jul 15, 2004 01:30 PM|j_gaylord|LINK
Dim objRequest as HttpWebRequest Dim stmOutput as StreamReader objRequest = (CType(HttpContext.Current.Request, HttpWebRequest)) stmOutput = New StreamReader(objRequest.GetRequestStream(),System.Text.Encoding.ASCII)
I then realized I didn't have to do that. So, to get my Stream, I just grabbed the InputStream like this:Dim stmOutput as StreamReader stmOutput = New StreamReader(HttpContext.Current.Request.InputStream)
Thanks to Ben for forcing me to think this through. ;)ASPInsider and Microsoft MVP
http://jasongaylord.com