Sharepoint 2013 welcome page redirection issue - c#

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.

Related

Blazor page to MVC page

I try to logout in code in a procedure on a Blazorpage.
var url = $"{navigationManager.BaseUri}Identity/Account/Logout";
navigationManager.NavigateTo(url);
That doesn't work. I got the message
Sorry, there's nothing at this address.
Odd, because the address directly in the addressbar of the browser, brings me to the logout page.
What do I miss that blazor does not seem to find the logout
Force a reload with the second parameter your not using.
navigationManager.NavigateTo(url,true);

Asp.net Url loses page path on postback

Background:
We are redoing our website and trying to modernize it. We were initially experimenting with AngularJS but dropped it due to some of our users being on unsupported browsers. We ended up just doing VB webforms and updating the design and functionality of our site.
I was having an issue with buttons or items that cause a postback. When the page tries to postback it hits to the path but loses everything between the hostname and the last "/"
For example I have a login page set up in the location
/Secure/Account/Login.aspx
I have a route as well that directs from /Secure/Account/Login.
So when you visit the page you are at:
www.website.com/Secure/Accounts/Login
When I click the login button though, instead of posting back, I am directed to:
www.website.com/Login which doesn't exist so I get an error.
This occurs if I navigate to the page instead of using the route as well. So if I am at www.website.com/Secure/Accounts/Login.aspx and click the button, I end up on www.website.com/Login.aspx with an error.
This doesn't affect pages in the root directory as long as they do not use routing attributes. We have some pages that use routing attributes that have the same issue though.
We have page /Category.aspx in the root directory with the route
/Category/{Attribute1}/{Attribute2}/ configured for the page.
If I am on the page www.website.com/Category/Attribute1/Attribute2 when I click on a button that posts back, I end up at www.website.com/Attribute2 with an error.
The issue ended up being a really small piece of code from when we were working with Angular
On our master page .aspx we had included the line:
<base href="/">
Removing this line, which we didn't even need anymore fixed the issue.

IE failed to redirect the page

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.

Redirect to Browsers Homepage

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.

Asp.Net page reload problem after login

I am devolping a web application.the problem is that i am using a login control (not a .NET control) which is a part of master page and is acessible from all pages. if user log In from a page the login control updates itself and displlay some statistics of logged In user but the specific page does not reload. (some options on page are visible only to authenticated users, so that after login, page should be reloaded to display such options)
after logIn methoed I wrote
Reponse.Redirect(Request.Url.AbsoluteUri)
after this the browser response the "Page cannot be displayed"
It would be of great help to me.
Many Thanks, Regards. AZHAR
From you description it is not clear what happens, but with high possibility you get infinite loop, when page is redirected to itself again and again.
Most obvious problem that you place redirect code in Page_Load,
as possible resolution:
Place Reponse.Redirect(Request.Url.AbsoluteUri) to OnLogin event of your login control
if you anyway want use Page_Load, at least add following check:
if(IsPostBack)
Reponse.Redirect(Request.Url.AbsoluteUri)
But last case is very bad style because may have lot of side effects.
Make sure your redirect is not causing a loop. Check Page.IsPostBack
Be aware that POST variables are lost during this operation.
Another thing that you should look at is the roles that you allow in the folder (in the web.config file in the folder).
I accidentally misspelt a role name and it kept redirecting my users to the login page.

Categories

Resources