Controlling Which WebMethods Get Exposed Externally In A WebService?

Jan 11, 2010

I couldn't think of a decent title, so let me first apologize for that. I have a WebService (call it A) written for my app so I can take advantage of ASP.NET 3.5 AJAX features. I use the generated JavaScript proxy to make AJAX calls.As a side effect, WebService A is exposed for anyone to add as a reference to another project, which is great, except I don't want certain WebMethods to be available to external applications (in the same domain, BTW).So I've got two questions:Is there a way to control the exposure of WebMethods in WebService A?

If there isn't, I'm thinking I'll just add a separate WebService (B) that exposes the WebMethods I need from WebService A. But then,How can I prevent other applications from referencing WebService A while still allowing the application it originates in to access it?If that's not possible, I'm not really worried about it. The apps are all intranet-only, I just don't want the WebServices to be abused.Also, there is a similar question here already without any good anwers. The asker describes almost the same situation I'm in: [URL]

View 4 Replies


Similar Messages:

Webservice - Can It Have Two Webmethods With Same Name But Differnent Paramat

Nov 22, 2010

I have a webservice (using asp.net VS 2008).If I have two webmethods with same name but different input parameters and same output parameters. Just like given below. Can't I have two webmethods with same name with different parameters?


Code:
[WebMethod]
public Portfolio GenerateData(string As_of_Date, bool PortfolioLoadfromArchive)
{
Portfolio aPortfolio = null;

[code]...

Both TestProj.WebServices.Portfolio GenerateData(System.String) and TestProj.WebServices.Portfolio GenerateData(System.String, Boolean) use the message name 'GenerateData'. Use the MessageName property of the WebMethod custom attribute to specify unique message names for the methods.

View 10 Replies

Calling WebMethods / WebService Using Jquery Is Blocking?

Apr 6, 2010

I'm generating a file on the server which takes some time. For this, I have a hidden iframe which I then set the .src attribute to an aspx file i.e iframe.src = "/downloadFile.aspx"While this is taking place, I'd like to have a call to a web service return the progress. To do this, I thought I could use window.setInterval or window.setTimeout but Javascript seems to be blocked as soon as I set the iframe src attribute.Does anyone know how to get around this or perhaps try a different approach?I have also tried handlers, but the request never gets to the server so I'm assuming is a browser/javascript issue.

//Function that gets the file
function GetFile() {
setTimeout(GetProgress, 1000);
var iframe = document.createElement("iframe");

[code]...

View 2 Replies

WCF Vs ASPX Webmethods Vs ASMX Webmethods?

Dec 3, 2010

The intent is to create a set of web services that people can reuse. These services mostly interact with a backend DB creating, retreiving and processing data. We want to expose services so that people can use to create data mashups and other applications.End users are webpages that can be within our domain or outside our domain. For pages outside the domain we plan to release widgets that would be configured to retreive and display the data.

One requirement - application should be extremely scalable in terms of the number of users it can handle.Our code base is .net and we are looking at ASPX webmethods (or ASHX), ASMX webmethods and WCF (starting to read up on WCF). In terms of security/access I found that maintaining sessionid, memberships is doable in all three. WCF seems a bit complicated to setup. I could not immediately see the value of asmx when we can get all done just using a webmethod in aspx (with a little tweaking). Also, assuming that with the ASP.NET MVC2 I might be able to get clean urls as well for these webmethods.QuestionsWhich one will be the most effective in terms of performance and scalability? Any reason why I should choose WCF or ASMX?

EDIT I kind of understand that WCF is the way to go. Just to understand the evolution of the technologies it would be good if someone can throw light on why a aspx webmethod is different from an asmx when similar things (apart from discovery) can be accomplished by both. The aspx webmethods can be made to return data in other formats (plaintext, json). Also, it seems that we can build restful services using ashx.

View 2 Replies

How To Invoke Code Within A Web App That Isn't Externally Open

Sep 3, 2010

for example, you are caching data within your ASP.NET web app that isn't often updated. You have another process running outside of the app which ocassionally updates this data, when you do this you would like the cached data to be cleared immediately so that the next request picks up the new data straight away.The caching service is running in the context of your web app and not externally - what is a good method of calling into the web app to get it to update the cache?

You could of course, just hack a page or web service together called ClearTheCache that does it. This can then be called by your other process. Of course you don't want this process to be externally useable or visible on your web app, so perhaps you could then check that incoming requests to this page are calling localhost, if not throw a 404. Is this acceptable? Could this be spoofed at all (for instance if you used HttpApplication.Request.Url.Host)?

I can think of many different ways to go about this, mainly revolving around creating a page or web service and limiting requests to it somehow, but I'm not sure any are particularly elegant. Neither do I like the idea of the web app routinely polling out to another service to check if it needs to execute something, I'd really like a PUSH solution.Note: The caching scenario is just an example, I could use out-of-process caching here if needed. The question is really concentrating on invoking code, for any given reason, within a web app externally but in a controlled context.

View 2 Replies

Configuration :: Web Application Stops Working Externally?

Nov 15, 2010

My webserver stop working. It gives time out error. There is nothing in the event viewer.

If I access the web app on the web server using [URL], it works fine. Also the html pages have no problem. Just the asp.net web applications.

View 2 Replies

Referencing Javascript Libraries Locally Or Externally?

Sep 13, 2010

We are currently developing an ASP.NET MVC application which will be deployed on a corporate intranet, with a slightly-modified customer facing version available on the public internet.We're making use of a number of external javascript libraries (e.g. jQuery) and a discussion has come up regarding referencing the libraries - should we reference them from an external source (e.g. via the Google load jQuery method) or keep our own version locally and reference from there?The project manager is a little concerned about having a 'dependency' on Google (or whoever) if we reference from there, and thinks that having our own copy of the library makes us more independent. On the other hand, I have heard there are a number of advantages to letting someone else host the library - for example, they handle versioning for us, Google aren't going anywhere anytime soon...

(for the purpose of the discussion assume the intranet we're hosting on has external access - obviously if it turns out it doesn't the decision is very much made for us!)So. Does this matter? And if so, what should we do and why?(I appreciate this is subjective - but it would be very useful to get advice from anyone with experience or thoughts on the matter. Not sure if this is a candidate for community wiki or not, let me know if I should have put it there and I'll know for future!)

View 5 Replies

Configuration :: Passing Variable Externally To VB.NET Web Application?

Nov 18, 2010

I need to make the connection string in my vb.net web application be passed into the app externally. This is so I can re-driect the app to use either a test or production database. The same idea as a .INI file in a windows base system. someone suggested to me I use XML but I dont know how to do that.

View 13 Replies

Business Logic Not Exposed On Formview

Oct 16, 2010

I have to maintain an ASP.net application in VB.Net. There is a page with a FormView bound to a ObjectDataSource. I have to add some business logic on the ItemUpdating event of this FormView. Unfortunately, some the data that I need to add this business logic is not exposed on the FormView user-interface itself, so I can not use FindControl to get the values (I could add the controls, bind them to the fields I need and set their visible property to true, but that's ugly).

So, what I would need to do is to get access to the Data Row corresponding to the currently selected item in the FormView from the code behind as it has the data I need to add my business logic code. Unfortunately, I don't manage to get access to the row.

View 2 Replies

AJAX :: Pages Methods Not Being Exposed?

Feb 28, 2011

I am trying to use some page methods on an aspx page. I've done this several times before in other asp.net applications and never had issues until now. I believe that maybe the issue has something to do with the methods be exposed to POST but I'm not entirely sure. Everything on the page loads correctly then once it attempts to make an ajax call rather than hitting the "test" function, the page tries to reload and the page_load method is called again. I chacked the URL string on both cases when page_load is called and both are correct. I am suspicous that there is some need to do with the web.config but I'm not sure what. The application is close to 10 years old and has been grandfathered up all the way to ASP.net 3.5. On another note, I can hit asmx functions perfectly fine its only page methods that seem not to work.

Imports System.Web.Script.Services
Imports System.Web.Services
Partial Public Class CustomDataFilter[code].....

View 1 Replies

AJAX :: JS Methods Are Exposed Via A Control?

Jun 29, 2010

I found a write-up somewhere about the multi-handle slider control and in the post there were the following javascript lines:

slider.add_value(value);
slider.add_drag(value);

Slider, in this case, is my slider control... but how did the person know these two methods exists? Is there an API guide somewhere for the Ajax Control Toolkit?

slider.add_valueChanged(onValueChanged);

View 3 Replies

Iis7 - .NET Changes To Externally Linked Config File Cause IIS Application To Restart?

Nov 25, 2010

I have a config file linked from web.config e.g.<features configSource="feature.config" />When I make changes to the "feature.config" file the IIS application appears to restart, is this expected behaviour?

View 1 Replies

WCF / ASMX :: Consuming Web Service Which Is Not Exposed Directly?

Jun 14, 2010

I have created a webservice which is publicly exposed. This publicly created webservice can be consumed in the application But my requirement is I have to create a webservice to expose the schema and cannot be consumed directly.How to consume the web service which is not exposed directly.

View 1 Replies

AJAX :: Display List Of Operations Exposed From WCF Service?

May 25, 2010

Is there a way I can see the list of operations that are exposed by a WCF service same as we can with a asmx service?

View 1 Replies

Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(expr) Exposed Now?

Jun 15, 2010

I want to use the method:

Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(expr)

but I don't want to use Microsoft.Web.Mvc, is this call supported in asp.net mvc now?

View 1 Replies

Invoke SAP Webmethods In App?

Dec 5, 2010

calling a SAP Webmethod using ASP.NET application.

View 1 Replies

Best Practice When Using WebMethods And Session?

May 15, 2010

I want to reduce postback in one of my application page and use ajax instead. I used the WebMethod to do so.. I have a static WebMethod that needs to access the session variables and modify. and on the client side, i am calling this method using jQuery. I tried accessing the session as follows:

[WebMethod]
public static void TestWebMethod()
{

[code]...

The values are displayed correctly and seems to work.. but i would like to know if this practice is allowed as the method is a static methods and would like to know how it will behave if multiple people access the application.I would also like to know how developers do these kind of tasks in ASP if this is not the right method.

View 1 Replies

Call Javascript Function From WebMethods?

Jan 25, 2011

I am using PageMethods in asp.net. In code behind i have written a method which should call a javascript function for each loop & should come back & continue the loop.Is it possible?

[WebMethod]
public static void GetStatus()
{
for (int i = 0; i < 10; i++)
{
System.Threading.Thread.Sleep(500);
//Call javascript function
}
}

View 2 Replies

C# - JQuery / ASCX And Webmethods Not Seem To Be Working?

Apr 24, 2010

I have a cascading dropdown (3 of them) Type, Categories and Sub Categories. Type loads first and upon selection of Type, Category load and selection of Category, Sub Category loads. Also i have 2 buttons, "Add Category" and "Add Sub Category" Upon clicking on these buttons, i call a JQuery Modal Form to add them. I use Webmethod in code behind to add them to database

This works perfectly in ASPX page.

Since I need use this in 3-4 pages, i thought of making the above as User control (ASCX). When i try to use this in a webpage, the webmethods in ASCX don't get called.

View 2 Replies

Invoking WebMethods With XmlHttpRequest And Pure JavaScript?

Jun 22, 2010

I have what should be a relatively simple task that's frankly got me stumped. I've researched it until my brain is fried, and now I'm puntingHere's the scenario:I have an ASPX page (Q2.aspx) that is decorated with the WebService,WebServiceBinding, and ScriptService attributes. That page contains a method, GetAllContacts, that is decorated with the WebMethodattribute and returns a string containing JSON data. (For what it's worth, the pageitself contains no other controls or functionality.)I have an HTML page that contains JavaScript which uses the XmlHttpRequestobject to invoke the GetAllContacts WebMethod on the ASPX page and transformthe JSON data into an HTML table. I have verified that my Web.Config file contains the appropriate protocol handlersfor HttpGet and HttpPut in the WebServices section under System.Web.webServices.
I have verified that my Web.Config file contains the ScriptModule entry under theSystem.webServer.modules section, and that it matches the appropriate documentation.

However, when I view the HTML page in a browser, the following occur:The web request goes through, but the results are for the unprocessed HTML from the ASPX page.The GetAllContacts method is never invoked, as evidenced by setting a breakpoint in its code.The code to invoke the Web service, however, is invoked, and the JavaScript callbackfunction that is invoked upon request completion is properly invoked.

It appears that the JavaScript code is largely set up correctly, but for some reason that is completely escaping me at this point, the HTML page will simply not execute the WebMethod on the ASPX page, and simply returns the page as though it were a plain HTML GET request. Clearly, an HTML document can't be evaluated by JavaScript's eval function, which brings me to my problem. (Also note that the JSON data appears nowhere in the HTML that's returned.)I am, frankly, baffled. I've looked at dozens of Microsoft articles, StackOverflow posts, CodeProject articles, and who knows what else. My code looks like it's okay. But I know better. I'm missing something simple, stupid, and obvious. I just need someone to point it out to me.Below you'll find the ASPX page code and the HTML code, in the hope that they'll shed some light.ASPX Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Q2.aspx.cs" Inherits="Satuit.Q2" enablesessionstate="False" %>
<html>
<body>

[code]...

View 1 Replies

C# - Exchange Session Variables Between Webmethods In Webservices?

Sep 14, 2010

I have the following code to store session variable in one webmethod and retrieve it in other webmethod but the value displays null when i try to retrieve it.

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool SubmitList1(string businessname )
{
Session["Company_Name"] = businessname;
SqlConnection con = new SqlConnection();
.......
.........
.........
}

This will be my second webmethod where i am trying to retrieve the session variable

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public bool addresslisting()
{
string companyname = (string)Session["Company_Name"];// this particular value is displaying null
......
........
}

View 2 Replies

Globally Handling Exceptions In Static Aspx [WebMethods]

Mar 16, 2011

The default behavior of a [WebMethod] attributed static method on an aspx page is to return the error to the caller. We are accessing these methods using json, and the only way we have found of capturing exceptions is either a try/catch in every webmethod on the site or using a javascript callback with the error (which has the unacceptable downside of exposing the error to the client).

Is there any way to globally handle these exceptions using the HealthMonitoring setup in ASP.NET?

View 1 Replies

VS 2010 - Application Error Not Catching Exceptions From WebMethods

Dec 19, 2011

I have some code that is throwing unhandled DivideByZero exceptions in a WebMethod. These exceptions are not being caught by the global logging in Application_Error in global.asax. why exceptions thrown from a WebMethod are not handled by Application_Error?

View 3 Replies

AJAX :: Restricting Webmethods For Populate Cascaded Dropdown On Page Load?

Sep 9, 2010

My scenario is i have 4 tabs, under every tab there are five cascadded combo. So for page load itself it calling webservice at last and populate all parent cascaded dropdowns in all the four tabs.

now I have made changes but still now its not working. By defeault [ScriptMethod(UseHttpGet = false)], so i made it [ScriptMethod(UseHttpGet = true)]. now on tab change i added that function and it is calling the web methods when changing the tab. But after the loading its again call the webservice and this time as the get is true so its not getting any value. And in the dropdown its showing "error 12030".

View 1 Replies

.net - DB Password Would Be "exposed" To The Hosted SVN Provider?

Feb 10, 2011

I'm considering a hosted SVN solution, preferably with Trac, but I have a major concern in doing so: Connectionstrings.I mainly work on websites, so all of them have connectionstring in web.config, which means my DB password would be "exposed" to the hosted SVN provider.

What have you guys done/thought about this "security hole" when you choose to use a hosted SVN provider ?I'm looking for either a way to avoid the connectionstring from being read by the provider, or just some clever insight into why I shouldn't worry :-D

EDIT: To clarify the sites are indeed ASP.Net based.

EDIT #2: Would it perhaps be safer to simply buy a hosted server, and install SVN, Trac and so forth on it myself ? (Like http://www.slicehost.com/)

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved