I have got a problem that I am redirecting the page to other domain using response.redirect, It works well in Firefox, but in ie it shows the blank web page. when i tried to see what happens in fiddler, it says that object Moved, but the redirect doesn't happens here. Interesting thing is I couldn't replicate this in my local environment, but it happens in my DEV and QAL servers.
When i tried in dev & QAL servers, IE redirects it to the desired page.Can anyone help??
Try to clear cache in Internet Explorer
You probably set redirect to some page and then change it to other page.
Sometimes when permanent redirect occurs, IE cache it and don't ask for a page one more time but get the redirect path from cache. IE don't even refresh the address textbox which is misleading.
Related
I am facing a weird issue where I have changed the welcome page of my sharepoint 2013 site to a page called Home.aspx, so now my welcome page link looks like https://abc.sharepoint.com/sites/ThisIsSCName/Home.aspx. When I share the link of the site, to my team as https://abc.sharepoint.com/sites/ThisIsSCName, most of the time it works fine and redirects to Home.aspx, but sometimes it's redirecting to default.aspx, for example, like once or twice in ten times when I load the site, it's redirecting to default.aspx. It's so strange. I tried hard to crack the error, but could not. Help me in this issue!!
Not sure why this is happening. Is it happening to a certain set of users or everyone?
but as a workaround, you can redirect from default.aspx to home page by placing a redirect script in content editor webpart on default page.
function Redirect() {
window.location="http://yourpage.aspx";
}
This will appear as if its redirecting to home everytime.
I'm deploying a .NET website on a private domain. Trying to login using IE 8 (the only allowed browser) just refreshes the log-in screen back, and can't redirect to next page.
Some notes:
- Problem never occurs with Firefox or Chrome (so probably not a
security issue).
- There are already other websites published on the same network that use IE-8 with no problem.
- Tried to disable all javascripts in both login.aspx and Master page.
- Tried to add
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
with different values in "content" (IE=8, IE=EmulateIE8...) with no luck.
Running the application from VS solution on deployment server works
fine, but after publishing on IIS, same problem occurs.
Any suggestions??
Edit:
I could narrow the resolution area: IE 8 does not keep session variables! I tried to redirect the login to a plain page that doesn't use session variables and it worked. Also, when I replaced the session variable with a constant value in the directed page, it worked. So the questions becomes: how to preserve session variables between pages programmatically?
Solved!
I spent weeks in this problem before I found, by chance, that IE8 cannot keep session variables/cookies for URLs that contain "underscore" in the domain name!! Thanks to the this link.
I still don't know if there's a workaround to make IE accept the underscore without changing the domain name. But at least we have a baseline solution for the client.
Cheers
I'm facing a really weird scenario here with my local IIS. I have hosted multiple sites in the default website in my local IIS. One of them has the login page. From the login page, I'm redirecting the user to another page that is located in another site (which is also hosted in the same IIS inside default website virtual directory).
Now in the submit button click event of my login page, after authenticating the user, I have written a "Response.Redirect(redirect_url)". the redirect_url is being formed dynamically and given as a parameter to the Redirect method.
While debugging, the final redirect_url that is being sent as parameter to Redirect method is:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
But after I try to go to the next step, I'm suddenly getting a HTTP 404 error saying that the resource doesn't exist and I have observed that Requested URL shown in the error page is different that what was dynamically sent to the Response.Redirect(...) method.
In the error page, the requested url shows the value as
http://localhost/CP/web/console/localhost/CPLogin?err=5
whereas my actual requested url formed in the code is:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
I'm just unable to understand why the requested url is getting changed automatically.! Also, I observe that "localhost" is being appended to the requested URL again which is not what is supposed to happen.
Please visit THIS link[^] to understand this question more clearly. I have added screen shot of the error page.
http://amoghnatu.wordpress.com/2013/09/16/question-please-help-iis-throwing-http-404-not-found-but-requested-resource-actually-exists-requested-url-also-changing-automatically/[^]
Thanks a lot.!
Indeed, the problem was with the way I had hosted the sites in my application. I just removed all the sites related to my application from IIS and then hosted all of them again much more carefully. This resolved the "wrong redirect url" problem.
Also, I had some tables with missing required data because of which I was getting the error code.
So after I got all the tables filled with the required data and also after properly hosting the application in IIS, my problem got resolved.
In IIS, go to relevant folder, right click and "browse". Check out what is the URL. In most cases, this is due to the URL should have port number appended. For instance it will be something like :
http://localhost:<port number>/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
instead of
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
I am working on an asp.NET 4.0 Web Application, using C#. I would like to redirect the user to the homepage of his browser. Is this possible?
This will be done because internally we are using an intranet, and we would like to make it redirect to that intranet without having to hard code it and since the homepage is by default the url of the intranet, it would be better if we could use the homepage instead of hardcoding it.
EDIT:
We are using IE here, and will not change most probably as that is the standard. So as long as it works with all IE Versions, it's fine.
Use Javascript to return to the user's home page,
e.g.
function goHome(){
if (window.home) {
window.home();
} else {
window.location = "about:home";
}
}
and then call the JS goHome() function somewhere on the page (or even on a hyperlink).
As stated above, use the about:home uri.
Another solution would be to store the intranet url in the web.config and use this value. Then if it ever changes you will only need to change it in one place.
As far as i know it is not possible (been researched alot). But if all homepages are the same why not simply use META REFRESH?
EDIT
Try linking to this: About:home
Go home!
worked for me in IE9
EDIT 2:
Sending user to their browser's Home Page using Javascript
This will get you started for firefox and safari
EDIT 3:
Response.Redirect("about:home", false);
You cannot redirect server side to a users homepage.
SERVER <> USER (server is not the user)
Therefore the server cannot know what the user's homepage is.
So if you you use some sort of javascript redirect, then you sort of can redirect to home, but its a little glitchy.
All in all there is no cross-browser way to redirect to a user's homepage.
You Can't!
You can't retrieve the user home page because of Security and Privacy issues, and there is no Cross-browser work around.
What you can?
You can redirect to any page, so you can simply redirect to your intranet home page.
its also more future proof so that if your intranet homepage changes you just have change to redirect to the new address instead of changing every single machines home page.
it's a really weird thing - i have a website that works perfectly in maxthon (internet explorer based browser). i started it in opera and found out that the data put in the Session dictionary on one site, is not available on the other... i mean i have Welcome.aspx, where when you click next the following code is executed:
Session["sessionData"] = sessionData;
Response.Redirect("~/Models.aspx");
while debugging i can see that in models.aspx Session in empty when executing in opera but everything is fine when executing in maxthon.
has anyone got any idea what can be wrong? because i'm clueless.. is this some opera preferences thing or is it something in code?
Edit: i checked Session.IsNewSession and while executing in maxthon isnewsession is set to false but in opera it's true. it seems that in opera when moving to a new page it somehow creates new session...
If your write the session on the first hit then you should do
Response.Redirect("nextpage.asp", false);
Otherwise it wont write the whole responsestream and the cookie might not have been written. You can instead choose to have cookiless sessions. But then your open to session hijacking.
ASP.NET session is stored by a key that is saved as a cookie in the browser. Check Opera to see if it is accepting cookies - it will need to in order for ASP.NET session to work properly.
Maybe you have cookies disabled in Opera. Session works (unless speciefies as cookieless in web.config) by storing an identifier in a cookie. If the brwoser does not allow the access, the server won't be able to locate the data