MVC link text from address bar - model-view-controller

I have made a website with MVC and I have a little problem on routing: the link addresses from address bar appears with some strange paramaters like:
http://localhost:1413/Account/LogOn?ReturnUrl=%2f
instead of
http://localhost:1413/Account/LogOn
What should I do to have customized addresses.
I don't use any parameters.

The ?ReturnUrl=%2f portion of the Url is added by ASP.NET when a user is automatically redirected to the login page. Its added so that after the user logs in, they can then be redirected to their original page.
In this case, %2f represents the / meaning that the user tried to access the landing page and was subsequently redirected to the logon page. After they login successfully, they will then be redirected to the landing page.
You can still use the http://localhost:1413/Account/LogOn

Related

redirect back not saving auth()->user

I have a form to update user information including username. on the same page, there is a sidebar that has a profile button href="{{route('profile',auth()->user())}}"
once the form is saved I redirect to the same page, the route to update user info is
Route::post('/profile/{user:name}/update' , 'ProfileController#update')->name('update-profile');
so it contains the name ( not the id).
the issue is when the page is redirected back to the same page the profile button is still containing the old user name, which leads to 404. Is there any solution to redirect back and updating the auth user in the sidebar with a new username?
Thank you
That's strange it should normally work. You can do
\Auth::setUser($newUser);
to set a new one.

Wicket Submit BehaviorListener after RestartResponseExeption and Session replacement

I have a AjaxFallbackLink to add a product into the wishlist of a customer. When a guest clicks the Link he is redirected to the login page with a RestartResponseAtInterceptPage. After successful login he returned to the first Page. But the URL contains the IBehaviorListener of my "add to wishlist" Link and every Ajax Link does nothing except to reload the page with no changes. I think the problem is the incorrect match of Page instance and BehaviorListener instance because my Page started with instance 1 and returned with instance 4 from Login Page. Everything works when the guest is already logged in.
How can i remove the illegal URL parameter or call the right Link callback to add the product to wishlist after successful login?
I think you need to do the following, in YourApplication#init() add:
getPageSettings().setCallListenerInterfaceAfterExpiry(true)
You can override it per Page if you don't want to enable it globally, see org.apache.wicket.Component#canCallListenerInterfaceAfterExpiry()

laravel 4 url redirect cache

In my app, Home is the default Controller set.
I am having a Main controller which redirects to home page if a particular session variable is not set.
After Login validation, session is created for the user and redirects me to home page. On home page when I click on the link to main page "http://domain/main" it redirects the user to home page again.
when i type "http://domain/main/" in the url, it opens the right page. but "http://domain/main" is redirecting to "http://domain/home".
when i clear session files in storage and login "http://domain/main" works but after some time it redirects me to home page again.
I believe there is issue with laravel caching as in my code the redirection handling is perfect.
Sometimes browser caches the redirect 301 url. So in your code if you set session variable on some condition. and you redirect(301) to a page on set of a session variable than your browser caches that redirection.
So if at first session variable is not set, and your code redirects(301) to a different link. next time when you set variable on client interaction and your session variable is set, even than your browser will redirect you to the cached link. to avoid that you must pass redirect http code to the redirectto('location url','302') function in laravel.

Changed admin url, and now cannot access Magento login page

I tried to change the admin url of magento. As per the basic settings, it was located on www.domain.com/admin
I tried to change that and now I can't even access the login page. When I enter the new word that I replaced with "admin", I am taken to a login page which just appears like a basic html page with a box for username and password, and when I login I'm taken to the homepage of the website.
I also noticed that the word has started to appear twice in the url of backend such as if the correct address is to be:
www.domain.com/index.php/newadminword/system_config/index/key/0ddf3e37ef9a494c10afe626dee8efc7/
but when I login by that basic html page, the url becomes:
www.domain.com/newadminword/index.php/newadminword/system_config/index/key/0ddf3e37ef9a494c10afe626dee8efc7/
I removed the first 'newadminword' from the url and then I'm being led to the magento admin area, but here as well, the page is again basic html. The following link is a pic of how my magento dashboard looks now.
http://i.stack.imgur.com/2Qnva.jpg
Can anybody help me with this? I'm not so good at programming so please try to keep the instructions as simple as possible. Thanks.

Controller Url removing

i am trying to remove magento controller url in browser address bar.
for example my site have URL WWW.test.com/ - this page is a home page for my site.
But but i have redirected to login page for customer login. once user type www.test.com site will be redirect to WWW.test.com/customer/account/login display login page.
So for Seo purpose i am trying to set "WWW.test.com/" as a login content with parent URL (WWW.test.com/) . I tried all the ways using ht access. but not reflect.
Can any one able to give me better solution for this problem
(Sorry for bad English)
Thanks all
The easiest approach is to insert login form HTML into your CMS page.

Resources