Dim context as HttpContext = Me.Context

You don't even need to use a variable here... the HttpContext is
always accessible through the 'Context' property of the Webservice
class.

;-)

On Dec 20, 11:14 pm, jtaylor <jtay...@lorencook.com> wrote:
> Here's my new web method:
>     <WebMethod()>
>     Public Sub myWsSub(ByVal parms As String)
>         Dim context as New HttpContext(HttpContext.Current.Request,
> HttpContext.Current.Response)
>         context.Response.ContentType = "application/json;
> charset=utf-8"
>         context.Response.Write(tableToJson(CreateDataTable(parms)))
>     End Function
>
> Isn't that instantiating a new HttpContext object?  Is that not the
> right way to do it?
>
> On Dec 20, 5:39 am, Cerebrus <zorg...@sify.com> wrote:
>
>
>
> > I think you might have actually accessed the HttpContext object
> > (Context property) instead of instantiating it. You already have the
> > best solution, IMHO.
>
> > On Dec 19, 7:08 pm, jtaylor <jtay...@lorencook.com> wrote:
>
> > > I got my webservice to return the text I wanted by instantiating an
> > > HttpContext object and using the .ContentType and .Write methods.  Any
> > > reason not to just stick with that?- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to dotnetdevelopment@googlegroups.com
To unsubscribe from this group, send email to
dotnetdevelopment+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to