How Can I Run an Aspx Page From Shell?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How Can I Run an Aspx Page From Shell?
# 1  
Old 06-17-2011
How Can I Run an Aspx Page From Shell?

There is an aspx page which, when accessed with certain parameters in the URL, downloads a file. I need to do this with a shell script. I tried using wget, but I get a response of 302 from the server, which redirects me to the default page and then downloads the default page html itself. I quickly tried curl which seemed to be doing the same thing. It works perfectly from browsers on either Linux or Windows. Originally, I had a problem with interpretation of ampersands in the URL. but I put quotation marks around the URL, so that isn't the problem now.

I cannot fix this on the server side, because it will be from a variety of servers which are all set differently and which aren't under our control.

Thanks in advance for any help you can give me.

Brandon
# 2  
Old 06-17-2011
It may be blocking you because you're the wrong browser or have the wrong referer. Try
Code:
wget -U netscape --referer="http://site.com" "http://site.com/stuff"

Or it may actually be doing the redirection in the browsers too, but redirects to a page containing javascript junk which causes the file download.
# 3  
Old 06-17-2011
Thanks, but I am not using a browser at all. I am trying to do this in a shell script, or, actually, at this stage, just by typing it in at the command line. What is a referrer?
# 4  
Old 06-18-2011
If you'd read my post you'd have seen it contained instructions for using wget, and if you'd read wget's man page you would have found explanations for the options in it.

Quote:
Originally Posted by BrandonShw
Thanks, but I am not using a browser at all.
Exactly. So it tells servers that it's wget and gives them no referrer, with the result that many servers won't give it the time of day.
Quote:
What is a referrer?
Informs the web server what webpage they came from. Like if you loaded Google in a graphical browser, which loads among other things http://www.google.ca/intl/en_com/images/srpr/logo1w.png, the referer for that would be Google Load that same image from wget and it would have no referer.

Many providers refuse to let images and files be downloaded if there's no referer or a wrong referer, so you have to tell them you're actually coming from that page.
# 5  
Old 06-20-2011
I see, so the server may be employing some type of security based on header information, which could be changed with the -U and --referrer options. I will give it a try Monday morning. Thanks.

---------- Post updated at 08:09 AM ---------- Previous update was at 08:07 AM ----------

I tried "-U Mozilla" and "-U Mozilla/5.0" and it made no difference. I tried using a referrer, to the extent that I understand the concept, and it also made no difference. As a referrer, I used the page which would be used to download the file interactively in a browser. Anyway, it still gave me a 302 redirect and downloaded the default page.
# 6  
Old 06-20-2011
Did you try -U netscape like I suggested? And what did you use as the referer? All it is is what page the browser tells the server the request is coming from.

If user agents and referers don't help, there may be cookies involved.
# 7  
Old 06-20-2011
I tried "-U nestcape," "-U Mozilla," and "-U Mozilla/5.0."

As the referer, I used the page that one would download it from manually. I also tried just the site address.

That is, I tried both of:

http://www.site.com/ThePage.aspx
http://www.site.com/

Since I cannot make wget work through the page from which people access this manually, I am resorting now to a completely different methodology, but it is less desirable.

Thanks for your input.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Shell Programming and Scripting

Run SQL thru shell script: how to get a new line when run sql query?

Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database. I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :( What should I do? I'm not sure that... (2 Replies)
Discussion started by: Kapom
2 Replies

3. Shell Programming and Scripting

Migrating from Shell Script to HTML Page

Hi, Need Help, Recently I have thought to migrating my Korn Shell Scripts to html page..., already webserv is running on my unix machine. How to migrate the shell scripts to html page.. Please refer any web portal or sample codes. Thanks in Adavce (2 Replies)
Discussion started by: l_gshankar24
2 Replies

4. Shell Programming and Scripting

how to redirect to a web-page by shell script

Dear all, I am calling a korn shell script(CGI script) by a web-page. This shell script do some checking in a unix file and return true or false. Now within the same script, If it returns true then I want to redirect to another web-page stored in htdocs directory. Example: Login page sends a... (3 Replies)
Discussion started by: ravi18s
3 Replies

5. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

6. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

7. Shell Programming and Scripting

Executing shell program from a web page

Hi, I am looking for a cgi-script which runs a shell script from a web page. When I click "Run" from a web page it should run the shell commands in an textarea and results should get back to web page. Thanks Venkat (5 Replies)
Discussion started by: venkatritch
5 Replies

8. Shell Programming and Scripting

Invoking shell script from html/jsp page

I want to invoke shell script named bubesh.sh when submit button clicked on html/jsp page.I am using an apache server and the html & shell script are in the same working directory.Please help. (2 Replies)
Discussion started by: bubeshj
2 Replies

9. Shell Programming and Scripting

Access shell scripts from HTML page

Hi, I need (have been asked/order/instructed) to migrate the access of a number of ksh scripts into a html/web page environment. Currently access is with the user logging onto a unix box and accessing the scripts that way. The users are not unix people so I have restricted the access solely to... (4 Replies)
Discussion started by: nhatch
4 Replies

10. Shell Programming and Scripting

running shell script thru WEB page ....

....passing variable via list... here 's the HTML code extract : **************** <form method=post action=http://servername/cgi-bin/cgi-comptage_diff.ksh> <table border...........> .............. </table> <table bgcolor=#FFFFFF width="980"> ... (6 Replies)
Discussion started by: Nicol
6 Replies
Login or Register to Ask a Question