C# - Web Service API Design - Input Validation And Error Response?

Jan 1, 2011

This might be a silly question, how do you usually response to errors? Response with one error at a time or Response with multiple errors at a time, in a list record

Example

Invalid Email Address format
Invalid Phone number format
Invalid Password .etc...
Invalid API credentials

View 2 Replies


Similar Messages:

MVC :: Get Input-validation-error Css Set On Textbox Of Nested Object?

Jan 15, 2010

I have the following object:

[Code]....

In my edit View, I have the following:

[Code]....

Lastly, my validation in my controller looks like this:

[Code]....

The validation works for both First and Last in that the Validation Message is properly displayed for the appropriate error. However, the input-validation-error class is not being set on the textbox.

How do I ensure that the input-validation-error class gets set on the textbox when the textbox is tied to a field in a nested class of the Model?

View 6 Replies

C# - Software Design & Web Service Design

Dec 30, 2010

I'm about to design my Web service API, most of the functions of my API is basically very simular to my web application. Now the question is, should I create 1 single method and reuse them for both the web application and the web service api? (This seems to be the logical solution, however its very complicated; it's much easier to duplicate the method used by the web application, and keep both separate, ie one method for the web application and one method for the web service.)

1) REUSE: one main method and reuse them for both web application and web service application (I like this but it's complicated)

WebAppMethodX --uses-->
COMMONFUNCTIONMETHOD_X
APIMethodX ---uses---->
COMMONFUNCTIONMETHOD_X
ie Commonfunctionmethod_x contains reusable set of common features
PRO: less code, less maintenance, less bugs.
CON: very complicated

2) DUPLICATE: two methods, one method for the web application and one method for the web service.

WebAppMethodX
APIMethodX
PRO: simple
CON: duplication = more code, more maintenance, more bugs!

View 4 Replies

AJAX :: 4 Client Template: Binding XML Service Response Error "Name Is Undefined"

Jul 9, 2010

I am calling an AJAX Enabled WCF Service from jscript code and I'd like to bind the results to a very simple template. I get the results by calling the service via its jscript proxy:

[Code]....
In the OnComplete function the DataView is created:

[Code]....
The template which the data is bound to is really simple.

[Code]....
The XML response from the service is something like:

[Code]....

I get an error saying: 'Name' is undefined. I tried to bind Person.Name, ArrayOfPerson.Person.Name and several permutations without any luck. I'm sure I've been missing something here, and there should be an obvious answer.

View 1 Replies

C# - Override Error Message (The Value 'xxx' Is Not Valid For Age) When Input Incorrect Data Type For Input Field .net Mvc

Aug 24, 2010

I've tried to override error message when input incorrect data type in input field on HTML form.For example I have the model like this.

public class Person
{
public string FirstName {get;set;}
public int Age {get;set;}
}

For view, I put text input for Age to get it value.When type some string in Age text box like 'test' and press submit button.
I got this error message ,The value 'xxx' is not valid for AgeHowever, I want to change this message and try many way. There 's nothing effect this message value.

View 1 Replies

Page Design Is Being Changed During Response.write?

Dec 17, 2010

I hv a master page nd 3 content pages...my contents of d page r located in the middle of the page...

I have some alert boxes in my page...like this,. response.write(<script>alert('Invalid input')</script>);....

wen the "response.write" is executed. . all my contents of the page are moving to left side of d page and the fonts getting bigger and font style is changed as well . .

View 2 Replies

C# - Web Service Design - Error Code (store In Source Code Or Store In Database?

Jan 19, 2011

Web service error response (code/message etc) would you store it in a database? or would you keep the error response in a method.By the time I'm done with this, there will be hundreds of error response, maybe in the future, thousands? (I dont know yet, depends how large this web service grows).EDIT: error response is the response returned back to the application via the web service, (not to be confused with error logging).

View 1 Replies

Design A Webform For Entering/editing User Input Using C# Code?

Jul 15, 2010

After going through few asp.net 2.0 books surfacially, I want to accomplish most of the task using c# code and Sql database.

1.we can access and update data using various ways like using sqldatasource code, data reader,command object,dataset,datatable etc.But which one to use in which situation?I am very confused.what do you prefer most,why?

2. How to code professional way? I mean how to separate code using different classes and how to link all togerther?

3.I want to design a webform for entering/editing user input using c# code and use presentation control like gridview and detailsview for viewing,paging and sorting only.Is this possible?

View 2 Replies

WCF / ASMX :: Web Service Latency / How To Measure The latency(response Round Trip Time) For a Web Service

Jun 17, 2010

I am writing a program to measure the latency(response round trip time) for a web service. I need to have this at client side.

My initial plan is to store the time at which request is sent and then calculate the difference in time when we recieve a response from the web service. Is this the correct way to measure latency of web service. This has some overhead because of storing time and all. How can this be done?

Another option is to attach a timestamp with the SOAP request. But the server should return the timestamp. This will not be possible in case of third party web services.

View 4 Replies

Web Forms :: Empty TextBox Input Gives "Input String Was Not In A Correct Format" Error

Jun 10, 2010

I'm trying to update a db record via a business object, based on a users input.

In my button event handler, I check for a null or empty value like this before I set the object properties:

[Code]....

But if the textbox is empty, I get the "System.FormatException:

Input string was not in a correct format." in the line:

[Code]....

How can this be?

View 3 Replies

Best Practices For Input Validation?

Jul 3, 2010

What is the common practice of input validation? In other words do you check for input validation on client-side, on server-side or on both sides?

Also, if performance is crucial to me, would just the client-side input validation be sufficient for my website without presenting any security risks?

View 6 Replies

.net - DataType Input Validation In .NET?

Nov 3, 2010

I'm working on an application that has a large number of inputs for certain types (50 money inputs, 30 date inputs etc). I have been creating an CompareValidator for each one to make sure users are putting in the correct information but I am curious if there is an easier way to create the validation once and apply it to all desired inputs? Writing out 80 validators that do basically the same thing seems like a waste. Am I missing something that already does this in .NET or are there anything out there that can make validation easier?

Note: All validation needs to be done on both the client AND server side. I've read a little about ASP.NET MVC validation but unfortunately that won't be an option here.

View 1 Replies

MVC :: How To Retain User Input After Validation

Apr 25, 2010

I am making some change to my MVC app to allow user to modify their existing email address contained in the profile. I have 'email' and 'confirm email' fields both which load the existing email address when the user enters the edit page (both textboxes are loaded from the same database field). The issue I am having is that when the user edits the 'email' text field and forgets or enters a different address into the 'confirm' field, validation occurs and instead of retaining what the user entered it loads what's contained in the Model when it tried to save into both fields once again (to the user it would appear that validation should not have occurred). I would like validation to fire and retain what the user initially entered in the text boxes.

For example, if the original email address is [URL] and the user enters [URL] for the 'email' address and forgers or enters a different address into the 'confirm' field, validation fires and loads [URL] into both because that's what was captured during the attempted Save. I would like for [URL] to remain in the 'confirm' textbox, or if the user entered something that never matched that would remain.

How can I get around this but still have the existing email address load into both fields when the user initially enters the 'Edit' area?

View 3 Replies

MVC :: Required For View Input Validation?

Oct 11, 2010

Search thru the wauy to do view input validation, have seen quite often refers this [Required], eg:

public class ProductViewModel {
[Price(MinPrice = 1.99)]
public double Price { get; set; }
[Required]
public string Title { get; set; }
}

What this [Required] actually is? In which assembly?

View 3 Replies

.net 3.5 - Best Control For Date Input And Validation In ASP.NET 3.5?

May 12, 2010

Is there any other good control for date field input apart from CalanderExtender of AJAX Control Toolkit?

View 2 Replies

How To Design A WCF Service Which Can Support 10,000 Simultaneous Hits

Mar 28, 2011

I have to create a WCF service which can support 10,000 users simultaneous hits.

The job of the WCF service is to fetch a cached up XML object (we are using Enterprise Lib caching) and return it to the caller.

This WCF service will have to be publicly exposed. So I was thinking that we may have to use basicHttpBinding... I don't know, I may be wrong.

View 2 Replies

Design Pattern For Adding A Web Service In MVC3

Mar 4, 2011

Firstly - I'm not asking this question How to include a web service in MVC3? I know where the button is :-)

I'm trying to find an example of best practices of how to use the new DI / Common Service Locator framework in order to make web service calls (and code dependent on web service calls) testable. I've no experience of using NInject or the like - is that the way to go?

View 2 Replies

Addhandler Causes 'Error Creating Control - MainContent' Error In Design View?

Dec 11, 2010

I'm working on a page that uses a master page. In the master page, I have a drop-down and when a value is selected I generate an evenIn the web page, I have this statement "Addhandler Master.FilterChanged, AddressOf FilterChangedFromMasterPage"Everything works fine, and can edit the page as much as I want, but only with the Source view - because if I look at the design view, the entire MainContent section is reduced to this error; "Error Creating Control- MainContent / Object Reference not set to an instance of an object"But if I debug it locally, or FTP it to the server, it works just fine!

View 1 Replies

C# - Web Service - Currency Input

Feb 11, 2011

Web service API: I noticed that some companies like to pass integer as the "currency" amount, rather than pass a decimal data type with a decimal place ($ 100.29) is there a good reason why they choose integer for currency over decimal data type? Example, they do this

100 = $1.00
10043 = $100.43

Why not do this

1.00 or 1 = $1
100.43 = $100.43

View 2 Replies

C# - How To Handle Input And Parameter Validation Between Layers

Mar 5, 2010

If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer?

Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?

View 6 Replies

How To Disable Input Entry Validation In Web Forms

Nov 10, 2010

I need to show some html code in TextBox.this is my TextBox description:

<asp:TextBox ID="responseTextBox" runat="server"
Width="910px" ReadOnly="True" TextMode="MultiLine" CausesValidation="false" />

i am passing the html to it programatically, and it works, but on postback from page i'am getting the following error:

A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$responseTextBox=" ...

How can i disable input validation ?

View 2 Replies

Turn Off Input Validation For A Single Field?

Sep 27, 2010

I've got an ASP.NET 4 site on which I want to allow people to put '<' in their password. However, .NET gets in the way by blocking (what it sees as) an attempt to put HTML in a form field. I know I can turn off input validation entirely, but I only want to turn it off for this one field. Does anyone know an easy way to do that?

View 2 Replies

WCF / ASMX :: Design A Web Service Layer On Top Of Db For Data Integration?

Dec 22, 2010

We're doing a data integration project between a MS Sql Server database and a Microsoft CRM system (through its web services).

We're trying to build a "service" layer on top of the database. The design of our current solution is to use web services for CRUD, with xml being the format of data.

Views are created to consolidate related tables into one entity, and we query these views, using the "SELECT * FROM someview " + "For XML" to generated xml that will be returned from our web services.

For update we're trying to use the same approach - using SQL XML to map updates views, we have "instead of" triggers defined on top of these views, and in these "instead of" triggers we update the underlying tables.

The views/triggers are generated by tools so don't be too concerned with coding efficiency here...

what do you think if we use WCF data Provider to publish a enterprise data model (essentially DTOs) ? p.s., we don't have a BL layer for now, it's all in the stored procedures!!!

What's your opinion on this / any better design?

View 4 Replies

C# - Way To Create A Web Service With XML Response

Oct 4, 2010

What is the easiest way to create a web service with XML response?Use WCF to create the web service? (seems really complicated)If i want to use WCF to create my web service, where do I start?

View 3 Replies

How To Hijack Xml Response From Web Service /wcf

Apr 18, 2010

i want to"steal" the xml that the web service return to the client.how can i steal it ?what can i override ?i dont care if it will be also wcf...i just want to reach the result as xml after a specfic function start on the web serviceike there is no over ride to on serlize or something like that on the web service or any property on the client side ?

View 4 Replies







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