Using CreateControlCollection() From Within A WebMethod?
May 25, 2012
my code calls a WebMethod. Within that WebMethod I have the need to create a new control collection. In VB I would normally write:
Dim cc As System.Web.UI.ControlCollection = CreateControlCollection()
But because I'm inside a WebMethod, I get the error :
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
View 1 Replies
ADVERTISEMENT
Jan 12, 2012
I did the web method below using C#. I'm tryin to convert this into VB.NET, but I'm missing something. I'm using it with an ajax calling, from a paginator/sorter table plugin.
[WebMethod( EnableSession = true )]
public static object listaPessoas(int jtStartIndex = 0,
int jtPageSize = 0, [code].....
Second, I don't know how to return the message "OK" and the list of people.
View 1 Replies
Jan 21, 2011
I have an ASP.NET C# project consuming webservices and WebMethods are wrote in VB.NET with source code on a local IIS server. The WebMethod returns null, and I want to debug it to know why I get this.
View 2 Replies
May 31, 2011
I'm trying to eliminate a VB.NET button on my aspx page. Trying to use javascript and ajax to execute the same code my vb had.I put in a script manager, set EnablePageMethods to true, added a static subroutine, and referred to it in my javascript function (BTW -- this seems a lot of work just to execute an existing subroutine). The javascript calls my code-behind and it almost works.Problem is, now I'm getting a NullReferenceException when SimulatePrintBatchClick tries to do anything with the controls.
Error is 'Object reference not set to an instance of an object', line is 'pnlVars.Controls.Clear'
Here's the code from UW.aspx:
<WebMethod()> _
Public Shared Sub PrintBatchFromJSWM()
Dim UWI As New UW
[code]....
when I run the above code in PrintBatch_Click it all executes just fine. I really don't understand why it bombs out as a subroutine.
Perhaps this is not the way to do this, but I'm at a loss for finding a different way. Originally this code was handled by an ASP/VB button, but the specs have called for it to be deleted.
View 1 Replies
Jul 30, 2011
I am using an ajax PageMethod to call an asp.net webmethod. From there I'm trying to pass a lot of XML back to a callback javascript function.
Currently I just convert the XML into a string and pass it in that format. But it seems that if the string is too long it causes an error.
[Code]...
So my question is: Is there a better way to pass the XML from VB to javascript, or a way to allow large strings to be passed without error?
View 1 Replies
May 12, 2011
In a page to create new user accounts, we have a database with a little of allowable users. To streamline getting the Email address of the new user correct, we want to use an AutoComplete extended textbox.Now I know that WebMethods are working because I have a cascading-drop-down tied to web methods in another page.As I'm just starting on this page, the code is simple.The page itself:
<cc1:ToolkitScriptManager ID="ScriptManager2" runat="server"/>
<p></p> Please enter new user's Email:
<asp:TextBox ID="txtUser" runat="server" />
<cc1:AutoCompleteExtender runat="server" ID="autUser" TargetControlID="txtUser"
[code]....
I'm not even getting to the LogDebug statement. I've used all the same boilerplate code (Inherits, the 'WebService' tags, etc) that worked in the other WebMethod with the appropriate changes to the Class name but this really has me stumped.
View 1 Replies
Jul 12, 2011
I have a VB.NET function which looks like this:
<WebMethod()> _
Public Shared Function AuthenticateUser(ByVal UserInfo As String, ByVal Password As String) As Boolean
Dim UserName As String
[code]....
It calls the function, but won't return a value. When walking through the code, my VB function does fire (it will return true so long as the correct password is typed in), but the javascript 'authenticated' value remains 'undefined'. It's like you can't return values from VB functions to javascript.
I also tried
if PageMethods.AuthenticateUser("UserName", "Password")
{
//Stuff
}
But still no luck.
View 1 Replies
May 10, 2011
I'm developing a website with ASP and VB.NET 4. I'm also using the FullCalendar jQuery plugin, but I have a trouble: catching a parameter from querystring to the webmethod in the .asmx. I've tried to refer the querystring property with the Request.QueryString() and it doesn't work.
Here's the webmethod:
<%@ WebService Language="VB" Class="wbsCalendario" %>
Imports System.Web
Imports System.Data
[Code].....
View 1 Replies
Jun 18, 2012
here my function
<WebMethod()>
Public Shared Function person() As List(Of Class1)
Dim initialState = {New Class1 With {.id = 1,
[Code]....
how to pass initialstate values to knockout?
View 2 Replies
Mar 23, 2012
I'm trying to use an auto-complete, and it works fine if I call a function without a parameter in the web service:
<WebMethod()> _
<Script.Services.ScriptMethod()> _
Public Function GetCompanyNames2() As String()
[code].....
View 1 Replies
Aug 18, 2009
I have a Web Service with one WebMethod for which return value is boolean.It accepts XML file as string and process data. How can I first return status as true and then call the ProcessData method.
As the processing data takes time I need to return true first and then process the data.
[webmethod]
Public function receiveData(ByVal xmlstr as string) as boolean
dim status as boolean=false
try
[Code]...
View 2 Replies
Jun 22, 2011
when calling a webmethod
[WebMethod]
public Profile synchronize(string MID, DeviceUploadData data)
The object DeviceUploadData has many properties, and a few of them are array's. My question is about the array specifically. It loses it's value once it's received on the webmethod end.This is the property inside DeviceUploadData
Private data() As DataObject
Public Property Data() As DataObject()
Get
[code]....
So the DataObject is populated with data, then once passed, on the other end, some of the DataObject properties are no longer populated. I haven't included the other properties in this example.
View 1 Replies
Nov 5, 2010
I have a WebMethod that recives HTML as parameter somthing like this:
Public Function ConvertHtmlToPdfListAnswer(ByVal dokument As Dokument) As Byte()
In this HTML my path to for example user signature looks like this:
Handlers/SzablonyListImgHandler.ashx?usid=2006
My handler starts like this:
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
and it takes parameter from context, creates query for databese and returns stream output like this:
If Not String.IsNullOrEmpty(context.Request.QueryString("usid")) Then
...
...
streamOut.WriteTo(context.Response.OutputStream)
My problem is that it fires onle once...what I mean is that when I call the service again it doesn't enter the handler but it already shows me the image when i check the HTML in debugger view. So when The user changes his signature in database the service method still returns the previous one...
View 1 Replies
Jul 5, 2010
Getting sick with asp.net permission, This time, I Just cant AJAX-CALL any kind of webmethod or i just get: Message":"Authentication failed. [Code] THERE ARE SOME MISTAKES ON THE SUCCESS STUFF I KNOW. THATS NOT THE PROBLEM FOR NOW. Firebug Console always return 401 Unauthorized when i Try an ajax call.
View 1 Replies
Jul 6, 2010
I am using Virtual Basic with ASP.NET in Visual Studio 2008. I am using Webmethod to communicate from/to the server with the client. Data can be queried and returned in small amount, but when I try get a relatively large amount of data, it's returning me a Server 500 error. My data is 226561 character long, so it's not that large, but it's relatively larger than my other working testing set, which are about 10k character long.
JavaScript:
PageMethods.my_func("context", success);
function success(result, userContext, methodName) {
[code].....
View 2 Replies
Dec 9, 2011
I am using Virtual Basic with ASP.NET in Visual Studio 2008. I am using Webmethod to communicate from/to the server with the client. Data can be queried and returned in small amount, but when I try get a relatively large amount of data, it's returning me a Server 500 error. My data is 226561 character long, so it's not that large, but it's relatively larger than my other working testing set, which are about 10k character long.
JavaScript:
PageMethods.my_func("context", success);
function success(result, userContext, methodName) {
[code]....
Is there anything I can change to increase WebMethod returned string length limit? Is there even a length limit or is it some other problem I could not see?
View 1 Replies
Jan 23, 2012
I am trying to service AJAX requests with a method in my .aspx page. For some reason I am not getting the data returned that I want.
mypage.aspx:
<%@ Page Language="VB" Title="My Page" %>
<%@ Import Namespace="System.Web.Services" %>
<%@ Import Namespace="System.Collections.Generic" %>
[Code].....
When I click mybutton I get an alert "error:" and then whole lot of HTML that says:
Unknown web method testmethod.
Parameter name: methodName
View 2 Replies
Apr 22, 2012
I am trying to use the simple ajax script to webmethod as follows[code]...
View 3 Replies
Apr 24, 2010
I know how to call a simple old fashion asmx webservice webthod that returns a single value as a function return result. But what if I want to return multiple output params? My current approach is to separate the params by a dividing character and parse them on teh client. Is there a better way.
[Code]...
View 2 Replies
Jun 26, 2009
We're in a strange situation with a legacy winforms VB.NET 1.1 application using ASMX web services. Trying to send a user Token from a WindowsIdentity object as a parameter to a WebMethod. I will be adding a 'HACK: comment. System.Security.Principal.WindowsIdentity.GetCurrent().Token
The token is of type IntPtr, the first problem is the WSDL being generated doesn't support IntPtr with the error of 'unsupported type'I'm aware this is a big WTF question and sounds insecure, so any simple helpful alternatives are welcome but there are a lot of constraints on how we can change this system, including complications with the hosting environment. So I would just like to get our piece of data over to the web service to save a lot of other headaches.
[Code]...
View 1 Replies