Response.redirect with asp - asp-classic

I have a classic asp page that gets info, processes it and make and url
cadena="https://dominioexterno.com/actualizadatos.php?nombre="&nombre&"&identificador="&identificador&"&fecha="&fecha&"&tempe="&tempe&"&humedad="&humedad&"&lluvia="&lluvia&"&viento="&viento&"&funcion=actualiza"
response.redirect cadena
The page doesn't interact with the user, gets the info and sends it via response.redirect, but It didn't work.
When I paste the url in my navigator I get success but with the asp does...nothing.
What I'm doing wrong?
Can you help me?

your syntax looks fine, so to troubleshoot, I would try writing the url out to the screen, then copying and pasting that into a new browser window:
cadena="http
s://dominioexterno.com/actualizadatos.php?nombre="&nombre&"&identificador="&identificador&"&fecha="&fecha&"&tempe="&tempe&"&humedad="&humedad&"&lluvia="&lluvia&"&viento="&viento&"&funcion=actualiza"
Response.Write cadena
Response.End
if that works, then you have something wrong with the processing page. without more info, it'll be hard to assist you.

Josh, thanks for the answer.
It works fine that way.
I've been reading and realice that with response.redirect can't acces a page of other domain, I get "object moved to here..." and blocked the redirection.
I don't know how I can get the data from my domain and pass those data to the destination domain.

Related

SignalR - Error during negotiation request

I have a successfully running signalr project where the work is done from an html page. I have taken the exact same html and pasted it into a .aspx page (with no master).
The signalr connection fails from the .aspx page giving error: Error during negotiation request
Has anyone any idea why this is. The code is exactly the same in the html and the .aspx page.
Have not included code here as it is working from the html page but if someone needs it please just ask.
Gave up late last night, woke up and first thing I thought of was so blindingly obvious but will post here anyway in case it helps someone else - by moving to a .aspx page, a postback occurs when the input button is clicked (obviously)!. Anyway so by just adding return false; to the javascript button onclick function resolved the issue and am now able to connect to signalr.

How can i change session when open url in another tab in asp.net

I am developing one web application in asp.net. I am opening my all pages on pop up window. I want to expire my session or change the session value when someone copy the url and paste it into another tab. How can i implement it ?
Please help me out.
A simple way would be to check Request.UrlReferrer. The Referrer would be empty if the user copy pastes a URL.
A couple of points you should consider before using this:
Provide exceptions for any pages that can be directly entered by
the user. For e.g. the login page or a page that can be bookmarked
I believe a pop can be opened from Javascript, without a referrer. Make sure your existing code is not using this method to open a pop up.
For a generic way to determine if the user has opened a new tab, see here
I have solved this problem by using this
string referer = Request.ServerVariables["HTTP_REFERER"];
if (string.IsNullOrEmpty(referer))
{
Response.Redirect("../Index.htm");
}

urlrewriter.net page not executed

I'm having some problems with the module urlrewriter.net for ASP.NET.
I have a multilingual site with a URL like this;
~/home.aspx
To support languages I use this rewrite rule;
<rewrite url="~/de-DE/(.*)" to="~/$1"></rewrite>
Then in my code I get the de-DE part and set the right culture for the current thread. All of this works well.
After I login on the website I get a message "Hello, user x" to show i'm logged in. When navigating to another page, it doesn't display this message anymore and it seems like the page comes from the cache or something with the old (not logged in) data. Also, when I attach the debugger, nothing is executed for this request. If I visit the page like ~/home.aspx instead of ~/de-DE/home.aspx, does problem does not occur.
What could be the problem here?
Thanks
Nevermind!
I had accidently disabled the Check for newer pages in IE8 which caused all of the problems... I'm sorry for the useless question!

Detect Server.Transfer in Classic ASP

In Classic ASP, how do you detect on that the page got control via a Server.Transfer()?
I cannot compare the URL vs the current ASP filename because the code is stored in a library (included).
You can check if Request.ServerVariables("URL") matches the current page. For a Server.Transfer the URL is still the original page that was requested.
In response to your edit: The page needs to provide the current page name to the code in the library, otherwise the library has nothing that it can compare the requested URL to.
There is no way to acheive this without some assistance from the page calling Transfer or the page to which execution is transfered. Probably the latter would be the best place to do this and tweak the library code to accept details from it about the transfer (if any).

Why won't postbacks work on my domain root?

I have a form on a masterpage which is very simple but will not work when the site is at the root.
Works fine:
www.mysite.com/page.aspx
www.mysite.com/another/page.aspx
Does not work:
www.mysite.com
I click the button and it postsback to
www.mysite.com/default.aspx
But nothing has executed, now if I try the form again on /default.aspx it will postback and execute fine.
What am I doing wrong?
It sounds to me like the default page redirection is either accidentally (or intentionally) losing all form data. I would first suggest not redirecting to a page that doesn't exist.
However, if you insist, I'd try something like URL rewriting. Hopefully a rewrite from a module will keep the form data intact, but I can't say for sure it will. Good luck!
Thanks for the reply, I just figured it out!
I am using isapi to make sure my urls are all lower case, and 301 redirecting any upper case URL's to their equivalant lowercase version.
On postback its action is Default.aspx ... My script was redirecting it to default.aspx and loosing the values before it was posted back.. DOH!
Do you have an Index.aspx at the root of your site?

Resources