WCF / ASMX :: Best Way To "ensure" That A Web Service Is Only Called From AJAX On A Specific ASPX Page?
Oct 26, 2010
I have an ASPX page which hosts a Custom Control. That custom control needs to call an ASMX web service. I would use a PageMethod, if the fact that I'm calling from within a Custom Control didn't preclude that. I'm looking for some guidance on the most effective way to try and lock down the ASMX call such that it will only succeed for my users calling it from my ASPX page - and not for anyone trying to call it from elsewhere. I've seen various ideas around session variables and so on.
View 5 Replies
Similar Messages:
Aug 27, 2010
Service Function Getting Called Twice?
View 1 Replies
Apr 8, 2010
i have designed a web service which would create 2 csv files on the system. I want to send the links to the location of the files as an url attachment over the aspx page.
like : http://myserver/download.aspx?file1=C: empimage1.png&file2=C: empimage2.png
the output from the asmx web service is : [Code]....
where xx.xx.xxx.xxx is the ipaddress. this is the whole output i get from the webservice.
how do i get the aspx page to send the attachment in the format i mentioned above? I have added an asp website to the project and added the webservice as a web reference to this but i do not know how to get the location from the xml output file of the webservice result.
View 2 Replies
Dec 19, 2010
I have this function in aspx page.
[Code]....
and I call this function from JavaScript as below:
[Code]....
I want to know what is this technique called and what is the advantage of calling the function on that way
View 3 Replies
Aug 30, 2010
I am maintaining a web site project in VS2005 and have to call a new web service on a remote server. I've done add web reference, and created the .wsdl and .discomap files in the app_webReference folder. When I try to create a object representing the web service in the code ( wsnamespace.serviceName ws = new wsnamespce.serviceName(); ) the code wouldn't compile.
The web site project is already calling other web services. When I right click on the type representing the web service and "go to definition" it takes me to a proxy class (derived from of course SoapHttpClientProtocol) in the metadata. I think this is what's missing for the new web service i'm trying to call. Have I missed any steps?
View 1 Replies
Feb 9, 2011
In our project WCF service is acting as our BLL.
i had scenario where i had to fill list of object class without knowing its type see code:
Added contract
[OperationContract]
dynamic GetReferenceTableData(string tableName);
method in service:
public dynamic GetReferenceTableData(string tableName)
{
try
{
dynamic tableData = ReferenceTableDAL.GetReferenceTableData(tableName);
return tableData;
}
catch (Exception ex)
{
throw;
}
}
method at DAL(ReferenceTableDAL):
public static dynamic GetReferenceTableData(string tableName)
{
Database db = DatabaseFactory.CreateDatabase(Flags.ConnectionStringKey);
DbCommand dbCommand = db.GetStoredProcCommand("USP_GETTABLEDATA");
dynamic objDynamic = null;
if (tableName.ToLower() == "a")
{
objDynamic = new List<A>();
}
else if (tableName.ToLower() == "b")
{
objDynamic = new List<B>();
}
else if (tableName.ToLower() == "c")
{
objDynamic = new List<C>();
}
try
{
db.DiscoverParameters(dbCommand);
dbCommand.Parameters["IN_TABLENAME"].Value = tableName;
DataSet dsTableData = db.ExecuteDataSet(dbCommand);
if (tableName.ToLower() == "a")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((A)dataRow);
}
}
else if (tableName.ToLower() == "b")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((B)dataRow);
}
}
else if (tableName.ToLower() == "c")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((C)dataRow);
}
}
}
catch (Exception ex)
{
throw;
}
return objDynamic;
}
@ Aspx
try
{
using (DataServiceRef.DataServiceClient petService = new DataServiceRef.DataServiceClient())
{
dynamic tableData = petService.GetReferenceTableData(tableName);
//tableData is null ,exception
}
}
catch (Exception ex)
{
throw;
}
There is no exception at dal or service end when i debug list gets filled ok but when returns to aspx error at aspx(no exception gets caught at @ service) but exception at aspx i.e:
Message:The underlying connection was closed: The connection was closed unexpectedly.
Stack Trace: at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
View 3 Replies
Jun 18, 2010
I have a following php web service (nusoap-server-struct.php):
[code]....
how to call php web service from .aspx without adding Web Preference
View 2 Replies
May 5, 2010
if i have the web application with many pages like add order page, edit order page, and delete order page actually they also interact with the Sql Server 2008 and i also create web service page call Sales_Service.asmx. i know just i need to put something like query into Web Method in Sales_Service.asmx but i have a lot of queries, i don't know which query i should put into it and how the web page call the Sales_Services.asmx
View 2 Replies
Nov 11, 2010
When trying to edit the word before the delimiter the service method is not even called in IE but works fine in Chrome.
As an example, while '$' is set as a delimiter;
$csAux.Value$csNeedsPO.Valu
Now, editting the word
csNeedsPO => the autocomplete populates as expected succesfully.
csAux.Value => doesnT trigger the method in the background.
View 1 Replies
Nov 3, 2010
I have spent a couple of days on this one. I have an ASP.NET website that has Linkbuttons on
the Default.aspx page.. I added a WebService to the Website because later on the WebService will
subscribe to a Provider(Feed) of News, Sports and Weather and things like that. So when a Linkbutton
on the Default.aspx page is clicked it will connect to the link in the WebService which will load the News,
Sports or Weather onto the Default.aspx web page.
The problem is I can't get the LinkButton to execute the Link in the WebService. The link will call the page up
to where you see all of the Web References. But then if you want to execute one of those references you
have to click its link and the Invoke button that will follow. My questioh is how can the link on my Default.aspx
page execute the link in the WebService. Now I changed the LinkButton into an <a href> but I still can't execute
the link in the WebServices. I always use www.Microsoft.com as the link when testing and I wasn't sure about the return type
so I put "void" for an HTTPRequest, so below is the link from the Default.aspx web page and below that is he asmx file:
[code]....
View 2 Replies
Jun 22, 2010
I am new to WCF, I was using web service asmx before. I have trouble on making my wcf JSON ajax service work through http like asmx.Could you help me see what wrong in my code?My WCF services are defined in my website application folder. My aim is to call this service in my aspx page java-script code and return complex object back as JSON to my javascript. I have no problem on doing this through classic asmx web service.
When I try to test it through my browser by type this in the URL , URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc/GetAll. it return "Method not allowed."
But if I type just this URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc, it return this:
WCFCompanyService Service
You have created a service.To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
svcutil.exe URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc?wsdl
This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:
C#
class Test { static void Main() { HelloClient client = new HelloClient();
[Code]....
This is my Ajax-enabled WCF service code:
[Code]....
This is the web.config service model setting
[Code]....
View 1 Replies
Jul 3, 2010
I am using JQuery & JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file Below are sample codes
CustomValidate.asmx
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Public Class CustomValidate
Inherits System.Web.Services.WebService
'ACCESS VIA JSON
<System.Web.Services.WebMethod()> _
Public Shared Function AJAX_Test(ByVal date1) As Boolean...
Return True
End Function
End Class
Javascript: JQuery JSON
function isDates(source, arguments) {
var isValidDate;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CustomValidate.asmx/AJAX_Test",
data: '{date1: "' + arguments.Value + '"}',
dataType: "json",
async: false,
success: function(result) {
isValidDate = result;
},
error: function(httpRequest, textStatus, errorThrown) {
alert("status=" + textStatus + ",error=" + errorThrown);
}
});
arguments.IsValid = isValidDate;
}
It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: "CustomValidate.asmx/AJAX_Test" to "mypage.aspx/AJAX_Test". It works fine.
View 1 Replies
Dec 10, 2010
im using asp.net for my webpage. im also using the login control too. i want it so when the user types in the correct user name and password, it redirects to a new page called test.aspx. i dont want to use login view.
View 2 Replies
Apr 12, 2010
A Login.aspx has been created to enforce security on several forms of a web site.How can it be best called by each form at page load and return to that form after succesful login? How could that requirement be declared in web.config?
View 3 Replies
Jun 15, 2010
I am trying to call an asmx service using the jQuery ajax call-
[Code]....
I have double checked the url of the service and spelling/case of the name of the method as well as the parameters in the dataStr.
I still get the error-<b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. review the following URL and make sure that it is spelled correctly.
in the responseText of XMLHttpRequest, above.
View 3 Replies
Dec 9, 2010
A customer wants us to create an ajax-enabled web application that can be used to manage their IT environment (Active directory, mail, file security, ...). However, as the team that will support the web application does not know anything about these IT systems, they would like to split the coding so that all interfacing with the IT environment is done via PowerShell, which is known by the administrators of these systems. This would mean that if new functionality is required, the web team can just create an additional web page and interface and use PowerShell scripts that get created by technically skilled people in that specific topic (ie mail administrators). I don't see an issue using this approach for requests like adding a user where latency is not an issue, but I do wonder if this is feasible for interactive content with Ajax.
Ie I would like to implement a google suggest like search for AD users. This would mean that ie for every x keystrokes (or x seconds whatever approach I implement) an Ajax request will be made and the web application or web service will than use PowerShell to get the data. Taken into account that up to about 75 users can use this feature, is this something that would work? Not only performace-wise but also the number of connections (I read about the Powershell 5 remote session limit but also that it could be put to a higher number)? The example above is probably the most resource heavy Ajax requests (and can be optimized by caching), so taken into account they don't want this nice feature, are basic PowerShell scripts in ajax request really an option. My gut feeling is telling me this is a no-go, but I don't want to exclude the option just because it's not something I usually would do.
View 1 Replies
Jan 24, 2011
I have a page that allows visitors to register for an account, but I want this page to automatically redirect to a "registrationClosed.aspx" page on a specific date...
View 10 Replies
Mar 2, 2011
Ok so I am trying to setup a WCF web service. I thought I had my .svc and webConfig ready to go, but when I hit this service all I get is a blank page.
[Code]....
View 1 Replies
Mar 24, 2011
I have a problem to connect my ASP page with a Web Service.
I'm going to explain the situation:
VB: WEB SERVICE: service1.asmx.vb (http://localhost:1234/Service1.asmx)
[Code]....
FROM ASP page
I have not any problem to receive the string from the SECOND function
However, When I call the FIRST one I receive an error:
"Microsoft VBScript runtime error (0x800A01C2) the wrong number of arguments or invalid property value argument"
I use this object: recXML = CreateObject("Msxml2.DOMDocument")
View 2 Replies
Dec 14, 2010
I have created a dynamic web page . It gets loaded using a file keys.txt. This file holds the keys which are used to display a web page like panels order, text of labels , number of buttons and so on..It is consuming a web service written in delphi. All works fine but when 2 users try to access this service simultaneously then a error is displayed (Internal Server Error 500) "Access violation at address 0040404C in module "accelerate_gateway.dll". Read of address 00000000"Accelerate gateway is the name of delphi web service.It seems to me the problem of multi threading in delphi service ??But I have not done any multi threading in client asp.net page as well. ??It simply creates web service object and access its methods.As I am using a file contents to load a page, so I am concerned if it can create trouble as well ?? . Although I have used FileShare.ReadWrite in it.
View 2 Replies
Aug 3, 2010
how to invoke or use web service in our default .aspx page ?
i used following line to call webservice but its not responding,
1. service.useService("Webservice.asmx?WSDL", "UserDetails");
give solution for this problem.
2 style="behavior:url('webservice.htc')"
the above line also shows an error in behavior which is not a known css property. then how to use it?
View 2 Replies
Oct 1, 2010
My code below
BtnClick
YahooSample();
public void YahooSample()
{
HttpWebRequest request = WebRequest.Create("http://developer.yahoo.com/yui/") as HttpWebRequest;
[Code]....
View 1 Replies
Feb 24, 2010
.NET with VB I have a simple Gridview written with bound columns that gives a summary of all projects assigned to the user viewing the page.
I am struggling with passing the value of my project_ID column of a row that is clicked. I have looked around all day at different things, one involved using TemplateField with and ItemTemplate instead to fill my coloumns in stead of BoundField. This worked nicely to draw my Grid with the correct data from my datasource. I still struggled with two things.1. Selecting the row either button or ondoubleclick like event that runs VB code on my .aspx.vb page 2. Then the code to set a variable to the value for my project_ID columnThis is so frustrating, this was soooo simple in MS Access that was an on doubleclick event. That I simple set up set the project_ID.value = gblproject_ID and then called the new forum with the datasouce of that form filtered on the gblproject_ID. I am starting to think moving my MS Access DB online to .NET is far over my head.
View 2 Replies
Nov 18, 2010
Does anyone know where I could look to find how to create a simple login page.aspx via WebService?
View 8 Replies
Sep 7, 2010
I have a web service which is running fine when i call it from a handler page (.ashx).
My web service returns a zip file.
But when i call the same code from my aspx page then i get a corrupted zip file. Code for calling is below and is same in both ashx class and aspx page.
[code]....
View 1 Replies