I have an MVC 5 application with multiple controllers and multiple views(Controller1 with action1(associated view1) and Controller2 with action2(associated view2)). I defined Controller1 and action1 as default in RouteConfig.cs. The default url I see in the address bar is when I run the applicaiton from IIS is
http://andem.sunquestinfo.com/dxp"
I do not see the controller or action name. I navigate to view2 and see the View2 contents and the url in the address bar remains the same. Now if I refresh the page (either by F5 or browser refresh icon) I am redirected to view1 and the url doesn't change.
I tried using custom ActionFilterAttribute, but on F5 Request.Url is
"http://andem.sunquestinfo.com/dxp"
Please suggest why the controller and action name are not shown in the url and how I detect browser refresh.
Thank you
MA
Well one thing for sure is you cannot detect browser refresh server side, for the server its just another request/response cycle that gets triggered.
No you dont see the controller or action when you debug the application because it navigates to the root of your site, and you have configured your routing to default to a certain controller/action when it doesnt receive this info explicitly.
As to why the url doesn't change when you navigate to view2 its hard to tell because I dont know exactly how you navigate to it
Related
In my scenario there is a HTML web form that user fills it and after pressing submit button it redirects to another custom page, I want to instead of redirecting to another page redirect to my Flutter app and read some page parameters. Is it possible?
I need to block anonymous from entering the site, but I can't find the controller that builds the Home page nor the routing that redirects there.
Going to the widget admin and unpublishing/deleting everything in the anonymous layer, only hides the items but I need to redirect to the login page, just as the Admin area functionality.
And I cant' just remove the anonymous role, because they can access some pages and content, just not the Home.
Orchard, by default (though you can override this, see the blog module), uses the same controller to render all content items, including the home page.
What you need is the content permissions module, that has a part you can attach to content types (e.g. Page) that will let you specify, per item, what roles can view it. Attaching this and setting only authenticated to view your home page should redirect to the login page as desired.
We use OneLogin chrome extension for our application login, But sometimes the page redirects to some weird page upon successful login, while I check the chrome tool I can see the request initiator as "anonymous"
Is their a way to figure this out to identify the source which initiated the request?
So, if I understand correctly:
Log in on Page A.
Sometimes you get redirected to weird Page B. When you inspect DevTools, you see that the initiator for the main document was "anonymous".
In that case, you could try running window.addEventListener("beforeunload", function() { debugger; }) in the DevTools Console while you're still on Page A. That'll pause the page before redirecting, and you may be able to inspect the page to get more insight on what's causing the redirect.
Consider two web applications - A and B both hosted on different servers. On clicking a link in B, a HTTP request to made to A which responds back with the URL of A's page to be displayed to the user. Using its proxy, B hits the URL and A's page is displayed which has list of records. At this point the URL is like - https://B/proxy/A/context-root-A/page1.faces?un=1234 and everything works fine till here.
Now what I need is when a button is clicked in this JSF page1, page2 has to be displayed which shows record details.But,when the button is clicked the URL requested is like https://B/context-root-A/page2.faces?un=1234 and results in HTTP 404.
The original code just returned the path of page2 from A's context on the action of the commandButton. After watching some examples I thought of using External context redirect. But this redirect is not having any effect ending up giving the same HTTP 404.
The code snippet is:
<h:form name="myForm">
<h:commandButton value="view" action="{myBean.view}"/>
</h:form>
public void view(){
FacesContext.getCurrentInstance().getExternalContext()
.redirect("https://B/proxy/A/context-root-A/page2.faces?un=1234");
}
I am also appending the id of record as request parameters to the redirect URL. Ignored it here to keep the question simple. Also tried face-redirect=true but still not working.
I have tried to best explain the environment in which I am facing the issue. Any help on what I am doing wrong will be highly appreciated.
I am using Asp.net MVC3 and C# and IIS 7.5. I want that once user is registered he can browse my site using username.host.com and this username should be available to me in my URL so I can show the data related to that particular username only. All the logic is the same for all users. I don't want to do any fancy thing like if user1.host.com is entered then I want to redirect to a separate controller and action etc. All the application logic is the same for all users. I just want to change the way the url is shown in the browser.
Also, if possible I want this to work on localhost also in IIS/Cassini.
Eg: If I browse to jaggu.localhost:19883. It should send me to localhost:19883/Home/index/Jaggu (because by default Home is the controller and index is the method)
I am completely clueless on how to achieve this. Any help would be appreciated.
You may need a star A record, like *.host.com that points to your host.com site.
On your default page (or elsewhere via something like an IHttpModule) reroute the request to where you want the registered user to land.
Google: URL Rewriting for more information.