In side a Silverlight Page, I want to redirect to another aspx page in the same web site and using POST method to send some additional header information. Any ideas how to implement this? Any samples are appreciated. :-)
I am using VSTS2008 + .Net 3.5 + Silverlight 2.0 + C#.
My suggestion would be to have a Visibility=hidden Button on the page, and then use javascript to retrieve it and .Click() it. Thus you get to do a post without all the work that this guy went through:
http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/
Especially considering it's a bear to craft a POST-to-ASP.NET through javascript, as ASP.NET requires pesky things like viewstate etc.
I think you're looking for HtmlPage.Document.Submit() .
Can Silverlight initiate Page Refreshes?
Related
We have custom code behind code (deployed as DLLs in GAC) for some pages on one of our SharePoint 2007 sites.
Getting the jquery UI autocomplete plugin to work on an ASP.NET application was a breeze but I am having hard time recreating similar functionality for a SharePoint page. The data resides in a SQL Server table.
Do I need to configure the web.config for ASP.NET 2.0 AJAX Extensions 1.0 even though the code is not using any of that?
Any help/pointers are welcome. Thanks in advance.
You just need a point in your app where you can print out the data needed by the autocomplete.
I don't know how you exactly integrated your code into SP, do you have the ability to use
Response.Write("whatever");
Response.End();
at some stage in your page (PageLoad for example) and just get "whatever" as output, no master template surrounding it?
Then you can check for an incoming request var and print the data needed by the autocomplete:
if(Request["printautocomplete"]=="true"){
Response.Write("my autocomplete data as string");
Response.End();
}
Hi
I'm trying to write a windows application which can read HTML content of a specific website and fill some data in some input fields and submit the page.
what I did untill now was reading page content from a WebBrowser object, navigated to the website.
I know that i need to create some request/response variables and work with them, but I have no good view on what i'm trying to do.
also, my information about HttpRequest and HttpResponse is so low...
HttpWebRequest is what you're looking for, examples for read/write to scrape abound.
WebClient might be simpler for you to implement but in the end is only a wrapper to the above.
You can try to use the approach described in the HttpWebRequest with https in C# thread as a starting point.
I've application that uses another web sites data so how can i get it because it uses some JavaScript functions to get that data and it not show in page view-source.
Check the NET tab in firebug, XHR and check the resource that is requested, and request the same resource.
Basically you have to render the webpage and ensure the javascript functions are run (evaluated). You could do this by "borrowing" their javascript files (by linking to them from your own page), but this may not work as you don't know what's in those files - they could be accessing DOM elements that you don't have in your page, or calling to other domains which may prevent them from working correctly.
The easiest way to show the same data is to just host the page inside an iframe on your own page. If you are looking to do this from a normal client application (i.e. not a web app) then you will need a browser control that you navigate to the target page. If the browser control is invisible you could then scrape values from it and show them in your app, although this is a very clumsy way to do it, and it's debatable about how ethical it is.
If you want the another web site view source use the HTTPWebRequest to get the response stream in c#.
I have a website that is primarily PHP but we have built some new pages in c# .net. I need to be able to post (i think) to the PHP page.
The PHP page has a login that takes the login name and password. I am trying to allow my .net page to have a login that directs to the PHP page and once there the user is already logged in.
I believe I can post the data to the PHP page... is that correct?
If so, can someone share a code snippet that points me in the right direction?
Thanks for the help!!
I believe there is a cURL version for c#, the easy way would be to set that up if you can. Some information on using cURL with .NET can be found here and there are a few other resources on Google for c# curl
There are lots and lots of ways. I prefer javascript ( with jquery) ajax calls
$.post('login.php', function(data) {
alert( "returned " + data + " from php page");
});
see jQuery documentation for more details.
If you need to do this serverside (in the c# code behind), let me know, I will write up some sample code.
There's no difference between submitting a form post to a PHP script or to a C# application or to whatever program written in whatever language. How the data is transferred is defined by Internet standards.
Of course, different implementations may have slightly different behaviors. For instance, PHP considers all input names that have square brackets in their name to be part of an array.
For example on my site i got links to twitter,facebook etc.
and the link to the facebook is wrong, so when click the facebook link on my asp.net mvc page.
HTTP 404 will be thrown by the browser, so how can this be handled as this wont be caught by Application_Error in the global ascx page.
One way i could think of is tht clicking the link should call a action method
where it would ping the url and check if the link is working if works,thn it would redirect.
Is there any other way do this?
Periodically validate all your links using a tool like this one. I don't think it really makes sense to do this on demand when the user clicks on the link.
Use Custom errors part in web.config file