.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

REST WCF 4 with API key template

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :WCF
 
I have just recently finished customizing the WCF 4 REST service with API key template (available in the VS2010 online templates section).  It works great in debug mode but when I actually go to deploy in IIS 7 (Windows Server 2008 R2) it always breaks when I try to pass in the API key.  Does anybody have any ideas?  I would appreciate any feedback; I am not an IIS expert.


View Complete Post


More Related Resource Links

Exception Handling in WCF REST Service Template 4.0

  

Hi,

I'm using WCF REST Service Template 4.0 and so far, I'm able to create RESTful Services with the said template successfully. Now, what I need is a nice way to handle exceptions in a RESTful Service. As far as I know, when an exception is thrown from a service method, the returned http status code to the client is 400 (Bad Request). My problem with this one is that I can't pass along a detailed information about the error(s) that occurred in my domain or business logic layer.

Examples of errors that I need to pass:

new ValidationResult { FieldName = "ProductName", Message = "Product Name is mandatory" };
new ValidationResult { FieldName = "ProductName", Message = "Product Name is too long" };
new ValidationResult { FieldName = "Price", Message = "Price should be greater than zero." };

So, my plan is to make all my services always return a successful request (with http status code 200) even if a domain layer error occurred.

When the service call is successful, it will return something like this:

<OperationResult>
    <StatusCode>200</StatusCode>
    <StatusDescription>Successful</StatusDescription>
    <Data>
        <Product>
            <Name>Sample Product</Name>
            <Price>1.00</Price>
            <Culture>en-

Exception Handling in WCF REST Service Template 4.0

  

Hi,

I'm using WCF REST Service Template 4.0 and so far, I'm able to create RESTful Services with the said template successfully. Now, what I need is a nice way to handle exceptions in a RESTful Service. As far as I know, when an exception is thrown from a service method, the returned http status code to the client is 400 (Bad Request). My problem with this one is that I can't pass along a detailed information about the error(s) that occurred in my domain or business logic layer.

Examples of errors that I need to pass:

new ValidationResult { FieldName = "ProductName", Message = "Product Name is mandatory" };
new ValidationResult { FieldName = "ProductName", Message = "Product Name is too long" };
new ValidationResult { FieldName = "Price", Message = "Price should be greater than zero." };

So, my plan is to make all my services always return a successful request (with http status code 200) even if a do

Dropdown Event (Template Field)

  

Hi,

I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?


Empty template support for GridView

  

Just add the following to support the empty text in the GridView.

 

protected override void RenderContents(HtmlTextWriter writer)
{
	if (Extender.AdapterEnabled)
	{
		GridView gridView = Control as GridView;
		if (gridView != null)
		{
			if ((gridView.Rows.Count == 0) && !String.IsNullOrEmpty(gridView.EmptyDataText))
			{
				writer.WriteLine();
				writer.WriteBeginTag("div");
				writer.WriteAttribute("class", "AspNet-GridView-Empty");
				writer.Write(HtmlTextWriter.TagRightChar);
				writer.WriteLine();
				writer.WriteLine(gridView.EmptyDataText);
				writer.WriteEndTag("div");
				return;
			}

Example of tag to be added to the css
 
.NiceGridView .AspNet-GridView div.AspNet-GridView-Empty
{
	border-width: 1px;
	border-style: solid;
	border-color: #

Extreme ASP.NET: Text Template Transformation Toolkit and ASP.NET MVC

  

The Visual Studio T4 code generation engine lets you parse an input file and transform it into an output file. We give you a basic introduction to T4 templates and show you how ASP.NET MVC uses this technology.

Scott Allen

MSDN Magazine January 2010


Service Station: More On REST

  

This month's column answers frequently asked questions about implementing REST.

Jon Flanders

MSDN Magazine July 2009


Windows with C++: Windows Template Library 8.0

  

Kenny Kerr takes a look at Windows Template Library (WTL) support for new Windows Vista control enhancements, including task dialogs, Aero wizards, and open file dialogs.

Kenny Kerr

MSDN Magazine December 2007


Pure C++: Generic Programming: Template Specialization

  

As I discussed in my last column, a param-eterized type that does more than simple storage and retrieval is constrained as to the acceptable types that may be safely bound to it (see Pure C++: CLR Generics Versus C++ Templates.

Stanley B. Lippman

MSDN Magazine August 2005


XML Wrapper Template: Transform XML Documents into Visual Basic Classes

  

The XML Wrapper template described in this article transforms XML documents into Visual Basic classes, hiding the more complex parts of using the Microsoft XML parser. Developers who have little knowledge of XML or the Microsoft XML parser can use classes created with the template, thus making it easier to use XML in their projects. This article describes the template, shows classes in a sample application based on the template, and explains how to customize those classes to support repeating child elements. Although this project is illustrated using Visual Basic 6.0, the technique can be extended for use with other versions of Visual Basic and with other languages.

Dave Grundgeiger and Patrick Escarcega

MSDN Magazine January 2001


RPC and C++: Build a Template Library for Distributed Objects Containing Multiple Interfaces

  

Building a C++ template library for developing distributed object-oriented applications using Remote Procedure Calls (RPC) allows the programmer to design RPC applications that are composed of components that implement multiple interfaces. This article demonstrates the use of techniques such as assembly-level thunks to build machine code on the fly, and C++ features such as templates, conversion operators, virtual destructors and virtual function tables. Along the way, familiar C++ interfaces and classes are transformed into a distributed application. The benefits of using distributed objects rather than raw remote procedures, which include writing fewer lines of code, is explained.

Ajai Shankar

MSDN Magazine November 2000


More Windows 2000 UI Goodies: Extending Explorer Views by Customizing Hypertext Template Files

  

The Web-style interface is the default Explorer folder view for the Desktop Update in Windows 2000. The Desktop Update uses HTML-based hypertext templates to create the Web view, and you can customize these templates to include your own views and commands. This article shows you how the Explorer Web view works and how to build your own custom templates for it. You'll see how to add a command prompt and task buttons to a new folder view using HTML, script, and ActiveX controls. The shell object model and thumbnail shell extensions are also examined, then used to build a simple icon viewer for Explorer.

Dino Esposito

MSDN Magazine June 2000


jquery datepicker not popping up in Gridview Edit Template textbox

  

I have a gridview that I can't for the life of me get the datepicker calender to pop up for.  I've been using the datepicker for months very successfully for a variety of textboxes on the page and inside of formviews but this is the first time I've tried using with gridview.  I didn't expect any issues however can't seem to find anything to work.  I have searched the forums for 2 days and attempted any suggestions found within the solutions to no avail.  I've tried using the CSS to link the datepicker but everything stopped working when I changed the code and my page which uses a css style already got all distorted looking.  Please help!

Here is my gridview (only included a part b/c it is large and am only having problem with the datepicker for the date completed text box)

<asp:GridView ID="GridViewCompleted" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
        BorderWidth="3px" CellPadding="4" DataKeyNames="job_id" DataSourceID="SourceJobProjectCompleted"
        ForeColor="Black" CellSpacing="2">
<Columns>

Accounts in Default Template

  

Hi,  I'm trying to learn in the VS 2010 Express. Using the default template for ASP.Net Website. It starts the web application with an accounts folder. I'm trying to extend the "registration" or "AddUser" utilities. What I'd like to do is modify the registration by adding additional elements (i.e., address, city, ST, zip, etc.). I know I can open the database and modify the Users table and also modify the stored procedure for CreateUser.

My question is:  I don't see any reference in the page code (here's a reprint of the register.aspx.vb) that calls the procedure, or even passes in the variables from the textbox entries from the page. I must be missing something. Can someone clue me how to drill into this template to find the elements like how it communicates with the database. There are a few JQuery files. I am not yet very familiar with JQuery. Is that where I need to look? Thanks for any advice...

Public Class Register
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RegisterUser.ContinueDestinationPageUrl = Request.QueryString("ReturnUrl")
    End Sub

    Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser
      

Looking for a simple Service and Console Client REST sample implementing BASIC authentication

  

Does anyone know of a C# code sample demonstrating WCF REST services and console test client with OperationContracts (GET and POST) implementing mutiple paramaters using BASIC authentication? Also, perhaps, using Fiddler as a test client as well? I have searched high and low for something like this, but have not had any success.


Multiple services in REST Collection WCF Service?

  

After I create a "REST Collection WCF Service" project, it contains one service "service.svc". Can I add multiple services to this project? There must be a way to do so. Otherwise, it does not make sense to create one project for each service.

 

My question is how to add a new service to an existing "REST Collection WCF Service" project?

 

Thanks a lot.


how to develope a post and comments template like facebook

  

hi,

i want to develope desgin  like facebook .

where i have posts and comments will pick from the database that i inserted earlier.


what will be the best possible way to do in the same template.


Thanks



Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend