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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

HTTP POST in WPF/XBAP with partial trust

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :WPF
Hi, Is it possible to do a HTTP POST in XAML browser app with partial trust? I've tried to search for a solution, but I can't find any. I want to send a HTTP POST request to a website, within the same domain, that return a downloadable report (in a new window, _blank). I've earlier used hyperlink with GET parameters, but I have to use POST due to large amount parameter data. Is this possible? Edit: I'm using .Net Framework 3.5

View Complete Post

More Related Resource Links

Publishing xbap with partial trust, using WCF service for data backend, getting System.Net.WebPermis


It looks like these are very picky when it comes to how and where everything is setup. I've only got this to work when launching from visual studio. If I publish, I keep getting the System.Net.WebPermission exception. I am using .Net 4.0


IIS 7.5 (on my local machine)
Default Website
  --- QuoteTest (Application, ASP.net hosted website)
             ---Xbap(Was virtual directory, turned it into an application)

I'm thinking it's some magical order of settings in the publish tab that I need to do right.

  • Should I use localhost or my ip in the publishing location?
  • For the WCF service, is publishing to a File System Acceptable?
  • Any other security settings that I should set/be aware of?

HTTP Post and WebService


I am working on a application which will accept the data in the post request. My application also wants to expose a web service and want to call another web service. Considering all these 3 action that I want to do, can I create a single application which will have a web form which will accept the POST request and expose a web service at the same time.

Although it may be possible to achieve this, Is this a correct way of doing it?

HTTP verb POST used to access path ' ' is not allowed



Im new to ASP.NET MVC 2.

Im trying to call a controller method using Jquery $.ajax().

---- inside Controllers/ServiceController

public string GetString()


        return "My First MVC Ajax Testing";


---- javascript code calling the controller method

    var serviceUrl = '~/Controllers/ServiceController/GetString';

    var jsonData = '';


        url: serviceUrl,

        type: 'POST',

        data: JSON.stringify(jsonData),

        dataType: 'json',

        beforeSend: function (XMLHttpRequest) {



        success: function (data, textStatus, XMLHttpRequest) {

            onSuccess(data, textStatus, XMLHttpRequest);


        error: function (XMLHttpRequest, textStatus) {


Overload POST with X-HTTP-Method-Override as DELETE

Hi, How do I pass POST with the override header, X-HTTP-Method-Override, which will say I really mean DELETE in REST WCF 3.5? What changes are needed exactly in server side REST code & where to make those changes exactly? Can some one post code snippet? Thanks!

Receiving a message that was sent using HTTP POST

Hello helpers,   I'm somewhere between a beginner and intermediate asp.net and c# user who is looking to receive a message/variable and then URL decode it. The message is being sent via HTTP post. I'm not sure exactly how to get started, and am looking for a tutorial but haven't been able to find one. Can anyone point me in the right direction or give me some sample code to learn from? Thank you for your time  

Dynamic Image Buttons in GridView not doing partial post back

Hi Gurus - Create a gridview with AllowPaging and AllowSorting = true- On page load, I bind it to datasource (in my case a webservice) - On gridview's rowcreated event, I dynamically add image buttons on the header of the grid for sorting (up/down arrows). On header I have column name and the image. I removed the Column name default sorting link. So user can now only click the image button for sorting.-  Call sorting method This works perfectly fine without AJAX. The paging, sorting works fine. Also when I apply AJAX the paging works fine. But the sorting is doing a full post back instead of partial postback. I have my gridview within UpdatePanel and Triggeres is set on gridview sill it doesn't work.ASPX Code<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:Label ID="lblAccount" runat="server" Text="Account #: "></asp:Label> <asp:TextBox ID="txtAccountNumber" runat="server">12203A30</asp:TextBox> <asp:Button ID="cmdGo" runat="server" Text="Go" OnClick="cmdGo_Click" /><br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> &l

HTTP Post to Web Service?

I have a web service that I'm trying to consume from a console app through http post.  I receive a 500 exception error from the xmlstring parm being passed to the web service.  Can someone please help?   Add the following to web.config of the web service.  Although it is not working in debug in vs 2008 as well. <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> <add name="HttpSoap"/> <add name="Documentation"/> <add name="HttpPostLocalhost"/> </protocols> </webServices> The web service is not executing any logic:Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Security.Cryptography Imports System.IO Imports System.Text Imports System.Xml Imports System.Linq Imports System.Xml.Linq Imports System.Xml.XPath.Extensions Imports System.Data Imports System.Collections Imports System.Collections.Generic Imports System.Diagnostics Imports System.Net Imports System.Diagnostics.Process Imports System.Runtime.InteropServices ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptServi

WCF HTTP POST - The remote server returned an error: (400) Bad Request. - URGENT

client & sever code below-------------------------------------------- [ServiceContract(Namespace = "http://test.mydomain.com")] public interface IMyService{[WebInvoke(UriTemplate = "", BodyStyle = WebMessageBodyStyle.Bare, Method = "POST")] Stream SaveXML(Stream input); } ----------------------[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(Namespace = "http://test.mydomain.com")] public class MyService : IMyService{  public Stream SaveXML(Stream input)   {              StreamReader streamReader = new StreamReader(input);       string rawString = streamReader.ReadToEnd();       streamReader.Dispose();        // here need to save the input stream to xml format file          //       Encoding encoding = Encoding.GetEncoding("ISO-8859-1");       WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";         byte[] returnBytes = encoding.GetBytes(rawString);       return new MemoryStream(returnBytes);   } } --------------------------------------------------Client Code         string postData = GetXmlString("d:\\text.xml"); // user function        WebRequest request = WebRequest.Create("http://test.mydomain.com/myservice.svc");        request.Method = "POST";        byte[] byteArray = Encoding.UTF8.GetBytes(p

create web service with http-post method


hi All,

we need to expose a web service to the 3rd party vendor which can only call using POST protocol, NOT SOAP.

So my question, is it better to build a web service or just simply .aspx page?

Also is there any best practice documentation on this.



How to get remote site url from HTTP POST


I have a remote website form which sends variables to a page of my asp website. This is a standard form with http post.  How do I access the url which sent the request to the page? Is this an environment variable? Http_referrer?


Retain partial data in model over the post backs


Hello Everyone,

I have recently started learning ASP.NET with MVC 2 Framework, I am facing difficulties in the following scenarios

In my MVC application I want to retain partial information in Model over post backs.

Following is my scenario,

1.    I initiate "Edit" of main record by clicking date hyperlink from left navigation.
2.    Amend some data.
3.    Save the record.
4.    "Edit" sub record of the saved record by clicking another hyperlink from bottom left navigation panel.

The page is divided in to 6 tabs, the first 5 tabs shows the data for the main record and the 6th tab shows data of sub record.  Wehn we "Edit@ sub record the previous 5 tabs doesn't have any changes noted, that means there is no harm in keeping their details intact in the main model.  So is there a way to access model in the controller on hyper link click action so that I can only load the data for the clicked sub record (I am asking this, because the hyperlink click uses HTTP GET method so no model parameter passed in action method). If no, then how do I retain partial values in the Model over post backs?

Note that each tab data have been kept in individual models, and a main model has a collection member to hold all these individual models together.

wrong action: http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Issue



I have developed a sample using WS-Trust 2005 (securityMessageVersion WSSecurity11WSTrustFebruary2005... ) and now I want to use WSSecurity11WSTrust13...  as I got the requirement to use WS-Trust 1.3.

I have my WS-Trust 2005 sample running, but unfortunately, when I try to migrate to WS-Trust 1.3, the following error occurs when the client receives the RSTR message:

The negotiation security message has the wrong action 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Issue'.

I've got configured the client to use WS-Trust 1.3, so I don't know what's missing. Any idea?

Here's the client's app.config



Full Trust WPF XBAP Cannot Write To EventLog


Currently I am intentionally making my XBAP throw an error...  I have some exception code in place to display the error dialog and log the details/InnerExcetion to Event Viewer.  On my XP VS2010 developers box this works fine under both Debug and Release.  So I publish the application to the Win 2008 R2 web server.  I launch the application from there on my same box and it still logs the error just fine, no issue.  BUT... if I have any other coworker launch the application from their XP machine, IE just completely locks up, no errors, nothing...

I have pinpointed it to being the EventLog writing that is causing the issue... if i comment out the event log writing, IE doesn't hang.  Here is the exception handling code:

      if (LogException != null)
        Exception exception = LogException;
        while (exception != null)
          EventLog.WriteEntry(Application.Current.MainWindow.Title, exception.Message, EventLogEntryType.Error);
          exception = exception.InnerException;
I was thinking a "full trust" xbap should be able to write to event viewer, and it does o

HTTP POST request and encoded string



I have to do a simple HTTP POST request by key/value pairs and receive a XML file with a session key. I made it work, but there's something strange about it - when session key includes character '&', then it return encoded like '&amp;'. After that my application needs to send that session key to server every time I make a query. When session key includes '&', then query won't work, because server side is expecting correct (not encoded) session key. Does somebody knows how to fix this problem? My HTTP POST Content-type is "application/x-www-form-urlencoded".

How can i send a http post, to get the girdview's data ? thanks


how to send a http post to asp.net web,

and to get the gridiview's data .

Gridview like this:




Client object Model partial trust error


HELLO  i have a sandbox solution webpart and i,m trying to execute below code in button click

 ClientContext CC = new ClientContext(SPContext.Current.Web.Url);
        List MyDiscussionList = CC.Web.Lists.GetById(new Guid("30F27722-C0DC-4CF6-9D42-43DE5747DD8F"));
        CamlQuery Qry = CamlQuery.CreateAllFoldersQuery();
        Qry.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>" + DiscussionName + "</Value></Eq></Where></Query></View>";
        Microsoft.SharePoint.Client.ListItemCollection LstCollection = MyDiscussionList.GetItems(Qry);

but when it gives exception of partial trust error

Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

can i execute client object model code through sandbox?



Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust



I want to pass parameter to Silverlight Control deployed as a Webpart.For this i used WebpartStorageAttribute for getting the values while configuring the Webpart.

It deployed Successfully but when i try to add webpart its raising the following error

Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: Could not load type 'Microsoft.SharePoint.WebPartPages.WebPartStorageAttribute' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

Thanks in Advance

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