How to call php through c# using API? - asp.net

I am trying to call a php website through API, which gives the below Error 403.
Kindly check my code below. If anyone has a solution kindly help me.

I guess your request is true, but the website detects that an application tries to get to website and blocks the request to stop scrapping website.
If you want to pass the server filter, I think you should check a request to this website from a browser and then add the browser headers to your request so the server assume it as a browser and will accept it.

Related

How can I get the source of a HTTP request?

The referer header does not always provide the full url of the site spawning the http request, and I would like to know if there is any way I could figure out the source url of the site that is making the request.
I am currently using OWASP ZAP as a proxy, but am unable to trace some of the http requests back to the source site due to the incomplete referer.
Try searching for the full URL in the ZAP Search tab. If that doesnt work try searching for just the path.
If the URL is generated by JavaScript then that might not work.
Depending on how you are exploring the app you may be able to work back through the history and work it out by a process of elimination, but that could take a while...

Need help to build http request for yoututbe video upload

Let me mention it first that I am a learner at building HTTP Requests. I am trying to examine HTTP traffic and how it works. I had some luck with loging in successfully by getting the values of various tokens from the page and passing them as parameters :
GALX, dsh, and bgresponse
to :
https://accounts.google.com/ServiceLoginAuth
with parameters:
continue=$continue&service=youtube&dsh=$dsh&hl=en_US&GALX=$GALX&pstMsg=1&dnConn=&checkConnection=youtube:1000:1&checkedDomains=youtube&timeStmp=&secTok=&_utf8=$_utf8&bgresponse=$bgresponse&Email=$Email&Passwd=$Password&signIn=Sign in&PersistentCookie=yes&rmShown=1
Now I am stuck at trying to build the HTTP Request to upload a video to Youtube. Apart from the video file what parameters do I need to pass to upload a video to Youtube?
Can anyone please help me build the HTTP Request?
Any help will be highly appreciated.
Thanks in advance.
Praney
I would recommend to use Google's Resumable Upload guide. It shows the HTTP requests you need, with a simple example. It was enough for me to get it working, but since Friday evening I am encountering a "503 : Service Unavailable" error, which should mean the Youtube API service is having some issues (although it might be because I did something wrong).

How to redirect from HTTPS to HTTP without warning message?

i have two web site: one HTTP site and other is HTTPS site. I will validate the credentials in HTTPS environment and will return to HTTP once authorized. The same is working fine in IE but in Mozilla im getting a warning as shown below.
How to avoid this warning message? currently im posting from HTTPS aspx page using java script to the HTTP page.
I think the problem is that you are posting from https to http. If you instead did a GET and preferably a GET without parameters you might get around the problem.
I agree with leppie. There is nothing is wrong with your code. It is how a good browser should work. Submitting sensitive data from a secure site to an unsecure site should not go without warning.
Recommended solution
Make both pages/sites "submitting page/site" and "submitted page/site" to run over HTTPS.
You can disable that warning message in Firefox which is not recommended. Go to FireFox>Option>Security>Warning Messages>Settings.

Response Redirect URL returns HTTP Error 400 - Bad Request

I'm a noob when it comes to ASP.NET. I know few basic commands such as Response.Redirect("URL") to redirect my application web page to a different location.
However i receive HTTP Error 400 - Bad Request, whenever i try to use the code shown below
Response.Redirect(Server.UrlEncode(this.Downloadlink));
where this.Downloadlink is a user defined property which returns something like this
http://mdn.vatsag.net/fp;files/DOWNLOAD/VTSetup.exe
If i post this link in the browser, the .exe file pops up (means the link is good)
However this error comes when i use the ASP.NET code.
Any form of response on this issue/reason is deeply appreciated.
See here: http://www.kirit.com/Response.Redirect%20and%20encoded%20URIs
In short: if you quickly want to fix the issue, remove the part of your code that is UrlEncoding the URL!

ASP.Net MVC3 - Is there a way to ignore a request?

I have an ASP MVC3 website with a rest API service.
When a user passes in an invalid API or they have been blacklisted i wish to ignore the response.
I know I could send back a 404 or pass back an 503 but if someone keeps polling me then I would ideally like to ignore the response causing a time-out their end. Thus delaying the hammering my server gets.
Is this possible within ASP.net MVC3? If so any help would be most appreciated.
Thank you
For what you want, you still need to parse the request, so it will always consume server resources, specially if you have an annoying user sending a query every 500ms...
In this situations you would block the IP / Header of the request for a period of, for example 10 minutes, but it would be a very good idea to block it on your load balancer and prevent that request that even reach your application, this is easily accomplish if you're using Amazon Services to run your Service, but all other cloud provider do support this as well, if by any means you are using a cloud hosting.
if you can only use your web application, and this is a solution that is not tested, you could add an ignored route to your routing mechanism like:
routes.IgnoreRoute("{*allignore}", new {allignore=#".*\.ignore(/.*)?"});
and upon check that the IP is banned, simple redirect using for example Response.Redirect() to your site, to a .ignore path... or, why not redirecting that request to google.com just for the fun of it?

Resources