Button not working in asp.net mvc application (environment specific) - asp.net-mvc

I have a asp.net mvc application deployed in production. User can save a form in draft state and then can submit the form later. This functionality is working perfectly but for two of our users in Malaysia, when they click on Submit button, nothing is happening. It seems that the button is not working (page is not posted back).
I am unable to understand what could be the possible cause. If there is a firewall issue, then site would not have been opened at all.
Can I use fiddler to check or if there are some other options?

Related

MVC4 External Login: Google provider button disappeared

The Problem: I used to be able to login to my MVC4 website using Google external login but suddenly the "Google" button doesn't appear. I get no such behavior when I try a new clean MVC4 project.
Debugging shows that the IsAuthenticatedWithOAuth property of the OAuthWebSecurity object throws a "Missing Method Exception" when ExternalLoginsList action in the AccountController tries to return the _ExternalLoginsListPartial view. Then, when rendering the _loginPartial view, the Request.IsAuthenticated is false. Also, the generated HTML includes the code for the button (so it means it's an authentication issue?)
The website is supposed to run on windows Azure but the problem occurs both in the cloud and when running locally. Actually the first time the button disappeared was after publishing a new version of the website to Azure.
3 hours of going round and round this and I'm not any closer to a solution.
Badly need help here. Thanks

What happened to the popup dialog in asp.net mvc4

I am fairly new to mvc and I tried mvc4 when it was still in beta. I remember that when I started a new internet project, I got a popup dialog for log in and registration by default. I don't see that when I start a new project anymore, is that gone from the internet project?
I believe the popup dialog you're referring to was just the jQuery UI Dialog that the sample project used to use:
The project was built to support both a straight request to /Login and one via the jQuery UI dialog which was slimmed down to look like it was only a popup. It did this by making the Login action return a different View based on it being requested through the frame or not as detected by a value in the query string.
You can of course have this again, you'll just need to do it manually (or dig out one of the older templates) as it's no longer in the default templates.
To help you out, here's a couple of somewhat related questions that contain the sample code (ContextDependentView is one thing I remember from this template) and probably some hints on how to recreate it:
Generating a modal jQuery partial view with MVC4 does not work
ASP.NET MVC 4 and ContextDependentView
MVC4 - ContextDependentView - What does it mean?
It was removed from the Internet project templates in the final releases of MVC 4. The popup was pretty slick but I imagine there were issues/complexities they decided to eliminate by just keeping the view/page for logon and registration. In the older versions that had the pop-up they still had the view/page for logon because of how forms based authentication works. If the user is not authenticated/authorized for a web site/page MVC does a redirect to the logon page. This will not work with a JQuery popup dialog on the same page. The popup only worked if you clicked on the Logon link for the page. I am guessing that they decided since they need the view/page logon anyway to simplify things and keep it consistent by eliminating the popup dialog.
I have implemented an MVC Single Page Application (SPA) that only uses a JQuery dialog for a popping up a dialog for logon, and eliminates the need for logon page. But it required a fair amount of customization to authentication/authorization process on the server and used basic authentication on the client.

Problems with ASP.NET MVC 4 Display Modes and Forms Authentication

I have an ASP.NET MVC 4 application that uses forms authentication (I started with the ASP.NET MVC 4 mobile template). I have also added display modes functionality to support mobile devices. However, forms authentication doesn’t seem to work with these different display modes.
In Global.asax Application_Start, I have
DisplayModeProvider.Instance.Modes.Insert(1, new DefaultDisplayMode("iPhone")
{
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf("iPhone", StringComparison.OrdinalIgnoreCase) >= 0)
});
to register a display mode for an iPhone.
In ~/Views/Shared, I have _Layout.cshtml for desktop browsers and _Layout.iPhone.cshtml for iPhones. In ~/Views/Home, I have Index.cshtml for desktop browsers and Index.iPhone.cshtml for iPhones. In ~/Views/Account, I have the standard .cshtml files that come with the ASP.NET MVC 4 mobile web template (Index, Login, Register, etc.).
In FilterConfig.cs RegisterGlobalFilters, I added filters.Add(new System.Web.Mvc.AuthorizeAttribute()); so that authentication is needed to navigate anywhere in the site (except the AccountController, which has [AllowAnonymous] on the Login and Register action methods).
This is all basic stuff and set up correctly. When navigating to the site in the browser (from both a desktop browser and an iPhone browser), the display modes settings/configuration works great and I’m taken to either the normal .cshtml files or the iPhone-specific files.
The problem occurs when adding forms authentication.
When I first go to the site, since I’m not authenticated, I’m redirected to the Login page (as expected). The URL shows as http://localhost:63087/Account/Login?ReturnUrl=%2f . After logging in, I’m redirected back to the root and on to the correct display mode. All fine.
However, the URL doesn’t change. It stays as http://localhost:63087/Account/Login?ReturnUrl=%2f . This is a problem. Now any future navigation gets confused and sends me back to the Login page (even though I’ve already logged in and was authenticated).
How can this problem be fixed?
How can an ASP.NET MVC 4 application with multiple display modes be made to work correctly with forms authentication?
Thanks.

Deployment of Asp.Net MVC app on Win2k3 issue

I’ve created an ASP.net mvc application on my windows XP machine. Now, I’m at the stage where I want to deploy my application. I’ve done some googling on how to install/configured MVC apps under IIS 5.1 and 6.0 but I’m still having issues although I’ve done everything, so I believe, by the book.
On my XP box, I’ve created a Virtual Directory and added the Application Mapping “.*” and unchecked the “Check that file exists”.
When I navigate to localhost/vince/ my page displays great! Once logged, I’m being redirected to:
localhost/vince/Transaction/Index
The view (Transaction/Index.aspx) simply displays business information…
The user, has the liberty to edit his account by clicking the MyAccount link which brings him to:
localhost/vince/Account/Index
I have a cancel button at the bottom of that view which basically brings you back to:
localhost/vince/Transaction/Index
The view source of that cancel button is this:
<input onclick="location.href='/Transaction/Index'"
type="button" value=" Cancel " />
The problem is when the user clicks the cancel button he is being sent to localhost/Transaction/Index
And I get a 404 page not found…Notice how the name of my virtual directory “vince” was removed.
To further my testing…I’ve decided to deploy my MVC app on Win2k3 with IIS 6.0. Created the exact same thing, Virtual Directory and added the Application Mapping, only to realize that it was doing the same thing. Now instead of creating a Virtual Directory, I created a WebSite. Oddly enough, it now works without having to change anything…does anyone know why it now works within a new WebSite as opposed to a new Virtual Directory.
Thanks
Your cancel button is sending the browser to /Transaction/Index. The important thing to note is the leading slash on that URL. This is sending you to the root of the site (with no virtual directory included). That's why it works on IIS 6 when you create a website - there is no virtual directory being used there.
The fix for this is to use the Routing infrastructure to generate the link for the cancel button - it sounds like you are already doing this for the other links in your application.
It doesn't sound like a server setting, os version, or iis version issue... What is the exact url that your cancel button is requesting?
Change your HTML to:
<input onclick="location.href='<%= Url.Action("Index", "Transaction") %>'"
type="button" value=" Cancel " />

asp.net mvc - site works fine locally but not after deployment

i have an asp.net mvc website. http:/mywebsite.com (just for this example)
I have been testing this asp.net mvc website locally on my machine and everything works fine on my local machine during testing. When i deploy to my web server
when i bring up http://mywebsite.com it goes to HomeController and load the view Views/Home/Index.aspx (which is perfect). So the main default page is fine.
The issue is, if i click any other other links (again that all seem to work fine locally) i get the following error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
* Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
* If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
* Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
some examples would be:
http:/mywebsite.com\Photos
http:/mywebsite.com\Links
there definitely are controllers and views setup for this (or it wouldn't work locally).
does anyone have any idea how this might work fine locally but somehow on the webserver it doesn't
Are you running the site on II7 in integrated mode? If not, you need to add a wildcard handler so that all URLs get mapped to your application. See Phil Haack's blog post on running ASP.NET MVC ON IIS 6.
Something else to watch out for. I had a static website - deployed on IIS 7.5. Added some MVC Controllers to handle some simple server side apps and then re-deployed it. I didn't copy the web.config file, because I wrongly assumed that everything that was needed was in the one that was automatically created by the server.
You must copy the web.config up as well.

Resources