URL doesnot change after login in laravel - laravel-5.3

The URL of login page is localhost:8000/login.
and after login it remain same but i want to return the URL name as the name of form after login as view page like localhost:8000/company_details. can anyone help me for how will i redirect to company_details with compact('company','email') and what will be my route to redirect with these two variables.
Here is my code.
if (!empty($login)) {
return view('company_details',compact('company','email'));
}

Ok, after reading your edits, I have a better understanding of your problem.
What you are looking for are redirects: https://laravel.com/docs/5.3/responses#redirects
Right now, you are saying that when people visit /login, you do some login stuff and return a specific view. Nowhere in your code does it say change the URL.
What you do instead of returning a view, is you redirect the user (see link) to the url you want, or the named route you want. This way the users browsers gets a request to go to another page (/company_details in this case) and changes the url and get whatever you are serving at /company_details.

Related

How to redirect a submitted Caldera Form to another page?

I created a form using the Caldera Forms plugin.
When submitted I want it to redirect to another page.
I've set up the Redirect Processor like in the screenshot below:
However when I submit my form I'm redirected to the current page with an additional parameter at the end.
ie. http://nsa/wordpress/?page_id=16&cf_id=17
How can I redirect to another page?
I was facing same issue, but just use absolution URL like /?page_id=16
mean don't use http://example.com (dont use domain name, just use the Page with "/")
so it could be /thank-you or /page_id=16

Redirect website on correct URL

I want to redirect my site to custom URL for example if I am using abcwww.test.com then it's working but i want to redirect this on www.test.com. before www if I am using anyhting like xyz, try anything it's working I want to remove these things from my URL and redirect to simple www.test.com.
I don't want any update in code I want it by IIS if possible
You can always split the string and take out any part and work on it. Strings allow you to do this.
Try this
string Url = Request.Url.ToString();
Url = "www." + Url.Split('.')[1] + Url.Split('.')[2];
It will take out the second and the last value, but will just make sure that the first value is always www.
IIS Url redirects
You can use codes to redirect the user from one page to another. But the same would be done. You will write the code, and will extract the part of the URL that must be same, and then use
Reponse.Redirect(Url);
..this will forward the user to the next page.
http://www.iis.net/downloads/microsoft/url-rewrite
http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

Each address that not exists, redirect to one page

I have some links in footer of a MasterPage. Home, About, Terms, Contact and so on. The Terms link has navigateUrl as : "~/en-us/Terms" and for Contact link: "~/en-us/Community/Contact".
In global.asax, my route table is as follow:
routes.MapPageRoute("", "en-us/Terms", "~/EN_US/Terms.aspx");
routes.MapPageRoute("", "en-us/Community/Contact", "~/EN_US/Community/Contact.aspx");
My problem is: I don't add Community/Contact.aspx in my solution yet, so when I click on Contact link, I expect to receive The resource cannot be found error, but it redirects to Terms page. Worse than that, every addresses that not exists, also do the same. For example, when I try "localhost:1384/en-us/someWords/anotherWords" (Exactly the same), it redirects to Terms page.
I delete cookies, delete browser history, delete ASPTemplate Files, shutdown VS, restart Windows, Clear solution, rebuild it and any thing else. and the problem remains
I use VS.2012, asp.net 4.
After Contact link was clicked, in browser address bar, I see localhost:1384/en-us/Community/Contact, but the content of page is exactly like Term page and I don't know why.
Because you are not giving the routes names, the first one becomes the default route. Thus defaulting to Terms.

Post Redirect Get in asp.net

I'm interested in implementing PRG in my website for some forms I've created. At present they postback to themselves, and obviously refreshing these pages posts the data in duplicate. Can anyone point me in the direction of a good tutorial of how I can code this into my site? I understand the logic but am not sure exactly where to start.
Thanks
After you postback to the form you simply need to perform a redirect after the postback.
DoPostbackProcessing();
Response.Redirect("FormConfirmationPage.aspx");
As a very simple example, basically as long as you redirect (GET) to another page then the user cannot duplicate the postback. Of course if there are any errors in the forum you may not want to re-direct, but this is down to individual requirements.
EDIT: A good example of this is search, instead of posting back and then performing the search you would redirect and GET:
// Instead of performing search now we will redirect to ourselves with the criteria.
var url = "SearchPage.aspx?criteria=" + txtSearch.Text;
Response.Redirect(url);
This then redirects, the page then checks for a criteria query string and THEN performs the search, and when the user refreshes it searches again - plus they can bookmark the page for instant searching.

How to get file name of any page regardless of URL?

I would like to force SSL on certain pages around the site, like for login, registration etc. by specifying a string array and checking whether the current URL fits a certain criteria in a custom HttpModule.
It works well, as long as the URL correctly reflects the page, however I use routing tables, so some requests I point to login page, if a page requires login, and I end up with a login page on the screen and with an URL for members' area.
Is there a way to find the actual file name of a page?
Example:
http://www.mysite.com/login - file name is login.aspx, which is not reflected by the url.
http://www.mysite.com/members - file name is still login.aspx if a user is not logged in.
Instead of using the URL, could you use the class name?
If TypeOf(Page) Is LoginPage Then
End If
System.IO.Path.GetFileName(HttpContext.Current.Request.FilePath);

Resources