From Flash to Asp.net [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a flash file, but I haven't got the source codes.
How can I get values from it?
For example if it was a html form, I can get the posted values like below:
Request.Form("myValue")
But it doesn't work. How can I get the posted values?
Thanks.

In HTML, this code:
Request.Form("myValue")
Is not accessing the HTML source code; it's accessing the data sent in an HTTP form post. In HTML, the input names happen to dictate which form variables are sent.
ActionScript (the Flash programming language) can do a post just like HTML. Here's some sample code:
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("yourpage.aspx");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.myValue = "foo";
loader.addEventListener(Event.COMPLETE, handleCompletion);
loader.load(request);
private function handleCompletion(e : Event):void {
// Do things after the post completes
}
If you post to an ASP.NET page or handler using this code, Request.Form("myValue") would work the same way as if an HTML form had been posted.

Related

How Can I autofill a form of other application from my application [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Is there any way to fill other application form from our application
It is possible to send an HTTP POST request to the remote application endpoint which is used to process the form submit. You could use the HttpClient class for that:
using (var client = new HttpClient())
{
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("param1", "value 1"),
new KeyValuePair<string, string>("param2", "value 2"),
new KeyValuePair<string, string>("param3", "value 3"),
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
var result = client.PostAsync("http://example.com/", content).Result;
var result.StatusCode;
var result.Content.ReadAsStringAsync().Result;
}
Depending on the status code you will know whether the request has succeeded or not.
I got your concern, actually you are looking for some kind of we site scrapping technique. You can do this in the following way:
You can use WatiN tool from http://watin.org/
You can create a Winform app & use Webbrowser control inside it. Navigate to your desired site. Handle the Load Complete event, search the web page controls and set the value. You too can click the buttons programmatically also.
Better use the WatiN tool for ease.

System.Web.HttpUtility.HtmlDecode not working for test %3cstrong%3ebold %3c/strong%3etest [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
System.Web.HttpUtility.HtmlDecode not working for test %3cstrong%3ebold %3c/strong%3etest
Output should be <strong>bold </strong>test
I believe you want HttpUtility.UrlDecode in this case.
HtmlDecode is for things like <strong>
You are mixing up html encoding with url encoding. So it is normal that this does not work. Try using HttpUtility.UrlDecode()
Example for Url encoding:
%3cstrong%3ebold%3c/strong%3e
Example for HTML encoding:
<strong>bold</strong>
HttpUtility.HtmlDecode is used for converting HTML entities, e.g.
var sample = "<strong>bold </strong>test";
var result = HttpUtility.HtmlDecode(sample);
// result = "<strong>bold </strong>test"
You're looking for HttpUtility.UrlDecode, I believe, which surrenders:
var sample = "test %3cstrong%3ebold %3c/strong%3etest";
var result = HttpUtility.UrlDecode(sample);
// result = "<strong>bold </strong>test"

How to add a wiki page through ItemAdded event receiver coding on the addition of a new item in a list? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a list named 'List1' in which I have 'title ' and 'WikiLink' columns. I want to add a wiki page on the addition of a new item using ItemAdded event receiver code and update the link on 'WikiLink' column. Please help me out in this. I have been stuck on this for quite a while.
Thanks.
To create wiki page, you will have to add new item into one of the libraries that accepts wiki pages. Typically it's Site Pages, with code more less like this:
var l = (SPDocumentLibrary) SPContext.Current.Web.Lists["Site Pages"];
var folder = l.RootFolder;
var f = folder.Files.Add(string.Format("{0}/{1}", folder.ServerRelativeUrl.TrimEnd("/"), "MyWiki.aspx"), SPTemplateFileType.StandardPage);
//Site Absolute url + Site-relative Url, more info on MSDN.
var url = string.Format("{0}/{1}", SPContext.Current.Site.Url.TrimEnd("/"), f.Url);

Scoop.it API access in C# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to access the Scoop.it API via C# to retrieve posts in topics. It's pretty much straight forward, in PHP, how are objects managed in C# and how to you access the properties?
Here's the php code which i'd like to get a C# equivalent of:
$topic = $scoop->topic(24001);
foreach($topic->curatedPosts as $post)
{
echo $post->title;
}
I couldn't find an API reference for Scoop.it in C#, but I would imagine that they conform to the naming standards in C#.
So the PHP code converted to C# would looke like this:
var topic = scoop.Topic(24001);
foreach(var post in topic.CuratedPosts)
{
Console.WriteLine(post.Title);
}
However echo in PHP prints something out to the web-page, so I would imagine that you want to replace Console.WriteLine with Response.Write.
If you have a class that looks like this, where Name is a property:
class Topic
{
public string Name { get; set; }
}
Then you would create an instance of Topic like this:
var topic = new Topic();
Now you can access the property Name like this: topic.Name

Calling Javascript on a loaded site [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How would I call a function in Javascript on a loaded site in a Windows Form Application web browser? For those that have used Chrome, I'm looking to call Javascript like you can with the Javascript console.
Here is the answer:
WebBrowser wb = new WebBrowser;
wb.Navigate( ... link or Uri ...)
object[] args = new object[1];
args[0] = 12';
wb.Document.InvokeScript("functionName", args);
InvokeScript runs javascript functions. if you have a javascript function like function check(value){...} than your functionName is "check" and your args array hold value, if you have more parameters you can fill your args as much as parameters you want. The code above runs the javascript function as functionName(12);
If you want to access any element you can use this code:
wb.Document.GetElementById("ControlId")
.InnerText = "Bla bla"
.InvokeMember("click")

Categories