ok guys,
so here's another weird one:
i have the following form:
<form method="post" autocomplete="off">
<fieldset>
<legend>Edit article</legend>
<label>Description<textarea name="txtDescription"><%=article.Description %></textarea></label>
<label>Content<textarea name="txtContent"><%=article.Content %></textarea></label>
</fieldset>
<input type="submit" class="fr" value="save changes" />
</form>
there is nothing on the code behind page beside getting the article.
the page loads very fast, under 1 second, with that data in the textarea's.
when i try to submit this form, the page takes forever to load (actualy, it does not load at all, but fails after a few minuets with No data received.
the textarea content is just some html, not large (about 2-4kb each text area)
i have tried adding enctype="multipart/form-data", with no success, the same thing happens.
i have managed to narrow it down to the txtContent textarea, (i removed the description textarea)
and the page fails.
what makes this even worse is that if i open the page in the browser on my server,
it works with no problem, i can post, and it is all working as it should.
if i try to access the page from a remote machine, the post fails.
Anyone has any idea as to what happens here?
EDIT: just to make sure, i have created a simple HTML document with the following in it:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="header">
<nav>
<ul>
<li>Dashboard</li>
<li>Articles</li>
</ul>
</nav>
</div>
<div id="content">
<form method="post" action="test.html">
<fieldset>
<legend>Edit article</legend>
<label>Content<textarea name="txtcontent"></textarea></label>
</fieldset>
<input type="submit" class="fr" value="save changes" />
</form>
</div>
<div id="footer"></div>
</body>
</html>
this still fails.
EDIT: the test code shown here is the minimal code that is not working.
the actual form is larger, and if i remove the txtcontent textarea from the form,
the form submits with no problem, including the description textarea.
EDIT: Content-Length: 1555 / Content-Type: application/x-www-form-urlencoded
EDIT: i have uninstalled and reinstalled iis, and re-registered .NET
the problem is still there.
A few things to check....
What language are you using, e.g. ASP.NET WebForms, ASP.NET MVC and version?
I can see you are using
<form method="post" autocomplete="off">
In ASP.NET web forms, you would normally declare the form tag as
<form runat="server">
In ASP.NET MVC it would be similar to
#using(Html.BeginForm(......))
{
}
The other issue is you are posting HTML tags, by default ASP.NET will not allow this due to security reasons. Lookup XSS and be sure to understand the risks before disabling this feature.
Final note:
i have uninstalled IIS, Re-Installed IIS, Re-Registered .net framework,
and it seems to work fine now.
the reason for the original problem, unknown
Related
So I have an app that I am trying to strip out all of the JQuery Mobile and now use Intel's App Framework. I am having trouble figuring out how to integrate multiple html pages into the app so that I don't have to have all my code in a single file. I tried this:
$.ui.loadContent("page2.html");
but that doesn't seem to work. I get a 'loading content' spinner but nothing seems to happen.
How do I link pages together from different files?
Ok so I have figured it out. The documentation can sometimes be hard to search and there is no search box available on their website right now. But if you go to the quickstart and then then AFUI(on the left) and then panel properties they say:
data-defer="filename.html" - This will load content into the panel
from a remote page/url. This is useful for separating out content into
different files. af.ui.ready is not available until all files are
loaded asynchronously.
So in my index.html file I have something like this:
<div id="afui">
<nav>
<ul class="list">
<li>Post a Lunch</li>
<li>Personal Profile</li>
<li>Select University</li>
</ul>
</nav>
<!--Main View Pages-->
<div class="panel" title="Events" id="event-list_panel" data-defer="event-list.html" data-load="loadMainEventsList"> </div>
<div class="panel" title="Description" id="description_panel" data-defer="description.html" data-load="loadEventDetails"> </div>
<div class="panel" title="Select University" id="select-university_panel" data-defer="select-university.html"> </div>
</div> <!--id="afui"-->
and then I have the details of each page in seperate files. In my mind this does a literal copy/paste, and I haven't found any evidences yet that it isn't just a copy/paste.
Update:
in AF3 data-defer is now data-include
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm creating an MVC4 project with JQuery Mobile UI.
This is my login form:
and this is my <form> in my html:
<form action="/Account/Login/" method="post">
<ul>
<li>
#Html.Label("User name:")
#Html.TextBox("userName")
</li>
<li>
#Html.Label("Password")
#Html.Password("password")
</li>
<li>
<input type="checkbox" name="rememberme" id="remember" />
<label for="remember">Remember me</label>
</li>
<li>
<input type="submit" value="Login" />
#{if (ViewBag.LoginFailed)
{
<br />
<b style="color: red;">Username and/or password was not correct. please try again.</b>
}
}
<br />
<br />
Not registered? Click here to create an account!
</li>
</ul>
</form>
My problem is: when I click on Remember me label or the checkbox, checkbox still remains unchecked...
How to solve this issue??
Edit: This is the complete output html from mvc, This is my style.css file, and this is the generated code in DOM.
(My project is changed since one month ago, so these outputs are a little different from the screenshot. But the checkbox still doesn't work...)
I tried it just now with jsfiddle and we know that Asp.Net MVC doesn't change HTML tags in output. But I also tried it in an MVC4 application and it worked. You can see the result here.
Your browser may has some problem with jquery mobile and if you are using chrome you can see the errors (if exist) using development tools of google chrome (to open it right click on page and click on inspect element).
update
your update give us an output file. I copied it in jsfiddle and it worked too. the problem isn't from HTML, JqueryMobile or another programming tools. I think it's because of your system.
I need to open another site in new tab from code behind in Asp.net MVC.
return Redirect("Url"); is used to open the another site within the same tab.
It doesn't really seem practical for the users, because after authenticating in the second tab, they have to refresh the first tab to see the effects.
The ReturnUrl property of FormsAuthentication seems to do what you want. When the user needs to log in, they are redirected to the login page, and after signing in they are redirected back.
If you are making extensive use of javascript and ajax, and want to keep the javascript variables of the current page but need to log in to do the ajax calls, there might be another solution. If the response of your ajax call is the unauthenticated header, open a lightbox or something like that with a username and password field. Use ajax post to the AccountController to sign in the user again. This way, the user is authenticated again, but you keep the javascript variables.
This can be done using javascript only. Try this.
<%
Response.Write '<script type="text/javascript">
window.open(url);
</script>'
%>
Hope it works.
if you call action from form and use input type of submit you can try
<input type="submit" formtarget="_blank" />
if you use link <a> or AjaxCall you can try
<a target="_blank"></a> or in ajax helper set property #target="_blank"
here is my code
cshtml
#using (Html.BeginForm("PersonsReport", "Reports"))
{
<br />
<div style="text-align: center;">
<input type="submit" formtarget="_blank" class="btn btn-primary" value="GetReport" style="width:100%;" />
</div>
<br />
}
controller.cs
public ActionResult PersonsReport()
{
return Redirect("/PersonsReport.aspx");
}
I am using ajax to load 3 jsps in a master page but the problem is it loads one after the other? I wanted to know if struts 2 can handle 3 action class calls at the same time? Or is it even possible to make such calls? My page is getting slow because of this, is there any other way to handle this?
<div id="content">
<div class="col1">
<div id="content_right">
<div class="curved section_content">
<div id="sub_header" class="curved_top">
<h2>
<s:text name="ft.history.title.details" />
</h2>
</div>
<sj:div cssClass="ajaxDiv" href="transferdetailhistory"
id="transfer_detail_content">
<div class="ajaxSection">
<div class="centeredAjaxSection">
<center>
<img style="vertical-align: middle;" alt="Loading"
src="${pageContext.request.contextPath}/img/bigindicator.gif">
</center>
</div>
</div>
</sj:div>
</div>
</div>
</div>
this would load the history page, like wise i load 2 more jsps
Struts2 can handle significantly more than three simultaneous requests. There are many large, scalable applications using the Struts2 framework.
The issue is most likely related to your code.
we are in our application using such cases in every now and than and never faced problem with this.
better come up with some code may be problem with your code or some configuration as Steven said in his repply
I'm seeing an intermittent problem on our web site. Some users are trying to submit forms via GET when my form method is POST. The errors always come from IE users. I have noticed a few UA strings have a reference to "yie8," which I am assuming is Yahoo's IE8 package. I think the Yahoo! toolbar might have something against me, but I can't replicate the problem on IE7 with the toolbar installed. The problem happens not only on this form, but various others, many of which are submitted via Ajax using the jQuery form plugin load() function with an object parameter passed. This example isn't one of those.
A simple fix would be to just take out all of my AcceptVerb() attributes, but that would be totally lame. Anyone ever come across something like this or have any ideas with dealing with it?
Here's an example exception log entry.
We've got a Web problem! Exception thrown:
http://my.web.site/User.mvc/ResetPassword
Method: GET
User: <not logged in>
UserAgent: IE 7 (Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1;.NET CLR 1.1.4322;.NET CLR 2.0.50727;.NET CLR 3.0.04506.30))
Exception: System.Web.HttpException
Message: A public action method 'ResetPassword' could not be found on controller 'MyApp.Controllers.UserController'.
Here's the HTML as it is rendered to the browser.
<form action="/User.mvc/ResetPassword" class="standard-form small-form" method="post">
<fieldset>
<div class="row">
<label for="usernameTextBox">User Name</label>
<input type="text" name="username" id="usernameTextBox" />
</div>
<div class="row">
<label for="emailTextBox">Email Address</label>
<input type="text" name="email" id="emailTextBox" />
</div>
<div class="row">
<label> </label>
<input type="submit" value="Reset Password" />
</div>
</fieldset>
</form>
And here's the signature of my ResetPassword action.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ResetPassword(string username, string email)
(and yes, the email address is required to match the one we have on file)
Possibly an answer raising more questions than actual answers, but in the spirit of trying to help...
On the GET calls, are "username" and "email" querystring parameters actually supplied? (your IIS log file may be recording query strings, so check there). If so, then the answer of Ben S may well apply.
If your web site is internet facing, then these calls may just be spiders not playing nicely.
If your site is internal, I'd suspect a user is playing with "refresh".
Have you tracked the client IP addresses which raise these errors?
I don't think you can do anything about this. Some browser plug-ins/toolbars have a feature which allows changing forms from GET -> POST and vice-versa.
If your users are doing this, there isn't really anything you can do.
When website visitors misbehave like this, you have to ask yourself, "What are the chances this is a legitimate misunderstanding?" In my opinion, using the wrong HTTP method is not something a browser does because it's old or buggy or whatever. It's an invalid request, so send 'em a 405 and be done with it.
(I have heard of some browsers and plugins trying to 'preload' pages that are reachable from the current page, but it's a lame 'feature'. My answer is still to treat it as an invalid request.)
I'd say it isn't really your problem. You design your site to work as intended, you put your GET/POST restrictions on your methods (for security or other reasons).
If the user tries to get around your security with some advanced tools/plugins (such as GET/POST switches) it's not your concern. You might want, however, to add some custom error pages to handle those scenarios and warn the user accordingly.