|
|
how to make a client side chatin in mvc4..pls help..i have tried this as server side..bt need to client side..
|
|
|
|
|
It will take a ton of code to do it. Can you ask a more specific question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have one page in my VS 2013 VB.NET Web App project that doesn't open in IIS Express, giving the above compiler error message.
The funny thing is that the page works fine if the file size of the .ASPX file is 263,113 bytes, but causes the error if it is ONE BYTE LARGER! But the 'one byte' must be in the Javascript, not in the HTML or anywhere else. It can be in a javascript comment. Add the byte, the page doesn't work -- giving the compile error. Remove the one extra byte and it works fine.
Event Viewer describes the error as: Event ID: 1310 Qualifier: 32768
Source: ASP.NET 4.0.30319.0
I can move the page to my test server and it runs fine. It only happens in IIS Express when debugging in VS 2013.
If anyone has a clue, please let me know! I really don't want to be running 'regular' IIS here on my development machine, but will if push comes to shove! My Web App is quite large and uses lots of AJAX. I have larger pages that do the same sort of AJAX which work without fail.
|
|
|
|
|
That error code, more frequently quoted in hex as 0x80070008 , means "not enough storage". From what I can see, it usually means you're running short on memory.
Try splitting the page up into user controls, and moving any script or style blocks to external files.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for this advice! While developing a page like this I like having all its script and style right there in front of me so I don't have to go hunting around, but if this is causing a problem I'll gladly move as much as possible into external files.
For now I've worked around the problem by removing all superfluous comments and reducing the javascript by generalizing and reusing some of the 'heavier' functions. But I still have lots of code to write here, so I'll hit the limit again at some point!
BTW: How does one convert an error code like 2147024888 into HEX 0x80070008 -- which actually does return useful stuff in the Google?
|
|
|
|
|
Stevens wrote: How does one convert an error code like 2147024888 into HEX 0x80070008
It's actually -2147024888 - the sign is important. And I tend to cheat and use the "Programmer" mode in the Windows calculator.
Alternatively, you can do it in code:
Console.WriteLine("{0:X}", -2147024888);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ha ha, works for me! Thanks!
|
|
|
|
|
I have an Intranet application and have developed a training video where I would like to have the users be able to view it.
I found the following code to have the Media Player embedded on my page ..
<embed id='embed1' runat="server" name='mediaPlayer' type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' displaysize='4'
autosize='-1' bgcolor='darkblue' showcontrols='true' showtracker='-1' showdisplay='0'
showstatusbar='-1' videoborder3d='-1' width='1024' height='768' designtimesp='5311' loop='false' />
In the Code Behind, I set the source for the video as follows:
embed1.Attributes.Add("src", Server.MapPath("~\Videos\" & sVideoName))
Everything works fine if I execute it within the Visual Studio 2015 environment, but when I deploy it to my IIS 7.5 (Win 2008R2) web server, nothing is displayed and no errors are listed.
I must be missing something on the IIS side. But what?
Thanks in advance.
|
|
|
|
|
Check in IIS if .mp4 is defined in the mime types for the app.
|
|
|
|
|
I am working on an asp .net application that is having a lot of performance issues. This application is a pre-ajax application. When the application is first displayed a default.html page loads and redirects the application to the primary asp page using JavaScript as shown below:
<script>
Handle = window.open('WebForm1.aspx','','width=300px,height=200px');
Window.opener = handle;
Handle.focus();
</script>
Now in the newly opened WebForm1.aspx page an asp:GridView is defined that opens a new asp page when a row is doubled clicked. The way this is handled is in the GridView’s RowDataBound event the follow command is added to the e.Row.Attributes value as below:
e.Row.Attributes.Add(“ondblclick”, “window.location=’WebForm2.aspx?id=” + view.DataKeys[e.Row.RowIndex].value + “’”);
Now, looking at how the application is designed and written using both the JavaScript window.opener and window.location methods could this be a primary source of the performance issues and if so is there a better way at implementing the functionality?
|
|
|
|
|
Most popup blockers are going to block your onload script. And why are you restricting the user to such a tiny window?
It would be much better to use:
location.assign('WebForm1.aspx');
That way, the page opens in the current window / tab, and doesn't get blocked.
Alternatively, remove the landing page, and set WebForm1.aspx as your default document.
Since you're using the RowDataBound events, you can retrieve the ID directly from the row's DataItem , rather than using the DataKeys collection:
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add("ondblclick", DataBinder.Eval(e.Row.DataItem, "ID", "location.assign('WebForm2.aspx?id={0}');"));
}
Alternatively, you could store the ID in a data- attribute on the row, and use JavaScript to wire up an event handler on the parent grid:
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add("data-id", DataBinder.Eval(e.Row.DataItem, "ID", "{0}"));
}
$("#GridId").on("dblclick", "tr[data-id]", function(){
var id = $(this).data("id");
location.assign("WebForm2.aspx?id=" + id);
});
The performance issues are most likely related to loading the data from your database. However, you would need to profile your code to determine precisely where the bottleneck is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
First, the page size is persented differently but I was just using the sizes displayed as an example. This is actually how the open command size is defined:
handle = window.open('WebForm1.aspx','SecSys', 'resizable=1,top=0,height=' + (window.screen.availHeight - 35) + 'width=' + (window.screen.availwidth - 10));
Now, from what you are saying you do not believe that the use of JavaScript to redirect to the different asp pages is an issue. Is this correct?
modified 21-Jun-16 15:24pm.
|
|
|
|
|
Using JavaScript to load other pages is unlikely to cause any performance problems.
I still think you'd be better off using location.assign instead of window.open . Displaying a splash page and then trying to open the real site in a new window will just annoy your users - especially as they'll have to turn off their popup blocker to use it!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I added a sitemap and then chose that as a source.
Then I get this:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Host 'fe80::ad93:da36:44e1:3cca%11' is not allowed to connect to this MySQL server
Source Error:
<siteMap>
<providers>
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>
I never chose MySQL, what is going on?
|
|
|
|
|
hallo,
i need a help from you guys.
i have follow code from msdn how to login connect ldap.
but when i wanna change password to ldap, it won't work.
here's my LdapAuthentication.cs code:
using System;
using System.Text;
using System.Collections;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;
namespace FormsAuth
{
public class LdapAuthentication
{
private string _path;
private string _filterAttribute;
public LdapAuthentication(string path)
{
_path = path;
}
public bool IsAuthenticated(string domain, string username, string pwd)
{
string _domain = domain;
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{
object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
_path = result.Path;
_filterAttribute = (string)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Error authenticating user. " + ex.Message);
}
return true;
}
public string GetGroups()
{
DirectorySearcher search = new DirectorySearcher(_path);
search.Filter = "(cn=" + _filterAttribute + ")";
search.PropertiesToLoad.Add("memberOf");
StringBuilder groupNames = new StringBuilder();
try
{
SearchResult result = search.FindOne();
int propertyCount = result.Properties["memberOf"].Count;
string dn;
int equalsIndex, commaIndex;
for (int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++)
{
dn = (string)result.Properties["memberOf"][propertyCounter];
equalsIndex = dn.IndexOf("=", 1);
commaIndex = dn.IndexOf(",", 1);
if (-1 == equalsIndex)
{
return null;
}
groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1));
groupNames.Append("|");
}
}
catch (Exception ex)
{
throw new Exception("Error obtaining group names. " + ex.Message);
}
return groupNames.ToString();
}
}
}
and this is my ChangePassword.aspx code:
<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="ChangePassword.aspx.cs" Inherits="FormsAuthAd.Account.ChangePassword" %>
<%@ Import Namespace="FormsAuth" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Change Password
</h2>
<p>
Use the form below to change your password.
</p>
<p>
New passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
</p>
<asp:ChangePassword ID="ChangeUserPassword" runat="server" CancelDestinationPageUrl="~/Default.aspx" EnableViewState="false" RenderOuterTable="false"
SuccessPageUrl="ChangePasswordSuccess.aspx">
<ChangePasswordTemplate>
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
<asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="ChangeUserPasswordValidationGroup"/>
<div class="accountInfo">
<fieldset class="changePassword">
<legend>Account Information</legend>
<p>
<asp:Label ID="Label1" runat="server">Domain:</asp:Label>
<asp:TextBox ID="txtDomain1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label2" runat="server">Username:</asp:Label>
<asp:TextBox ID="txtUsername1" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label3" runat="server" AssociatedControlID="CurrentPassword">Old Password:</asp:Label>
<asp:TextBox ID="txtPassword1" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Old Password is required."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="Label4" runat="server" AssociatedControlID="NewPassword">New Password:</asp:Label>
<asp:TextBox ID="txtNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword"
CssClass="failureNotification" ErrorMessage="New Password is required." ToolTip="New Password is required."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="Label5" runat="server" AssociatedControlID="ConfirmNewPassword">Confirm New Password:</asp:Label>
<asp:TextBox ID="txtConfirmNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="Confirm New Password is required."
ToolTip="Confirm New Password is required." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="txtNewPassword" ControlToValidate="ConfirmNewPassword"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Confirm New Password must match the New Password entry."
ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:CompareValidator>
</p>
</fieldset>
<p class="submitButton">
<asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"/>
<asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword" Text="Change Password"
ValidationGroup="ChangeUserPasswordValidationGroup" OnClick="Click_Change"/>
</p>
</div>
<script runat="server">
void Click_Change(object sender, EventArgs e)
{
string adPath = "LDAP://my-domain.com";
LdapAuthentication adAuth = new LdapAuthentication(adPath);
try
{
if(true == adAuth.ChangePassword(txtDomain1.Text, txtUsername1.Text, txtPassword1.Text))
{
Response.Redirect("~/Account/ChangePasswordSuccess.aspx");
}
else
{
errorLabel.Text = "Error Password!.";
}
}
catch(Exception ex)
{
errorLabel.Text = "Check It. " + ex.Message;
}
}
</script>
</ChangePasswordTemplate>
</asp:ChangePassword>
</asp:Content>
did i'm do something wrong?
what should i do to make void button change password will take old password and renew password to ldap?
anybody know how?
Thanks before.
|
|
|
|
|
You haven't shown the ChangePassword method on your LdapAuthentication class, so we can't tell you what you've done wrong.
But, based on the method call, you're not passing in the new password.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
can you give me a example of method on ldapauthentication?
because i still confuse.
if i want to change my password, should i make the changepassword.aspx connected with authentication?
thanks.
|
|
|
|
|
So you're saying that you haven't written the ChangePassword method on the LdapAuthentication class, and you're surprised that you get a compiler error when you try to call a method that doesn't exist?
This StackOverflow thread[^] has several examples. You'll want the ones that use the "change password" method, not the "set password" ones.
For example:
public bool ChangePassword(string domainName, string userName, string currentPassword, string newPassword)
{
string domainAndUsername = domainName + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, currentPassword);
if (entry == null) return false;
DirectorySearcher search = new DirectorySearcher(directionEntry);
search.Filter = "(SAMAccountName=" + userName + ")";
SearchResult result = search.FindOne();
if (result == null) return false;
DirectoryEntry userEntry = result.GetDirectoryEntry();
if (userEntry == null) return false;
userEntry.Invoke("ChangePassword", new object[] { currentPassword, newPassword });
userEntry.CommitChanges();
return true;
}
It might be easier to use the DirectoryServices.AccountManagement classes instead of the raw DirectoryServices classes:
public class LdapAuthentication
{
private readonly ContextType _contextType;
public LdapAuthentication(ContextType contextType)
{
_contextType = contextType;
}
public bool IsAuthenticated(string username, string password)
{
using (var context = new PrincipalContext(_contextType))
{
return context.ValidateCredentials(username, password);
}
}
public string GetGroups(string username)
{
using (var context = new PrincipalContext(_contextType))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username))
{
if (user == null)
{
throw new InvalidOperationException(string.Format("User account '{0}' was not found.", username));
}
var groups = user.GetAuthorizationGroups();
return string.Join("|", groups.Select(g => g.Name));
}
}
public bool ChangePassword(string username, string currentPassword, string newPassword)
{
using (var context = new PrincipalContext(_contextType))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username))
{
if (user == null)
{
throw new InvalidOperationException(string.Format("User account '{0}' was not found.", username));
}
try
{
user.ChangePassword(currentPassword, newPassword);
return true;
}
catch (PasswordException)
{
return false;
}
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank your for give me sample,
I will do it next, because i try with another method. And some problem come back. I will try with your code, but i want to finish this first.
i've make changepassword1.cs and i make changepassword.aspx, but the error say the current password and newpassword not exist. i try to convert textbox to string like this:
string CP = ((TextBox)ChangeUserPassword.FindControl("CurrentPassword1")).Text;
but when i run it,
System.Web.HttpException: ChangeUserPassword: ChangePasswordTemplate does not contain an IEditableTextControl with ID CurrentPassword for the current password
how can i resolve this sir? Thanks before
|
|
|
|
|
Look at your ChangePassword.aspx code - do you have a textbox with the ID "CurrentPassword1 "?
Based on the code in your original message, you don't. The textbox is called "txtPassword1 ".
The ID you pass to the FindControl method needs to match the ID of the control in the markup.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
ok sorry for that,
i tried to use same ID, but i can't get the value also
now, i change the method,
i use hmtl form in my webapp
but i found some error again in invoke.
the error says:
Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
in line 31(red code):
Line 29: if (result != null)
Line 30: {
Line 31: user.Invoke("ChangeUserPassword", new object[] { OldPassword, NewUPassword });
Line 32: user.Properties["LockOutTime"].Value = 0; //unlock account
Line 33: user.CommitChanges();
Stack Trace:
[COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))]
System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) +119
FormsAuthAd.ChangePasswordPSI.ChangePass(HttpSessionState Session, String OldPassword, String NewUPassword) in C:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\ChangePasswordPSI.cs:31
[Exception]
FormsAuthAd.ChangePasswordPSI.ChangePass(HttpSessionState Session, String OldPassword, String NewUPassword) in C:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\ChangePasswordPSI.cs:44
ASP.webform2_aspx.ChangeMe_Click(Object sender, EventArgs e) in c:\Users\Desktop\Documents\Visual Studio 2010\Projects\FormsAuthAd12\FormsAuthAd\WebForm2.aspx:56
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9692746
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3562
Now, i still confuse with throw ex;
why i can't use it?
|
|
|
|
|
Look at your code, and then look at the sample I posted.
Your code:
user.Invoke("ChangeUserPassword", new object[] { OldPassword, NewUPassword });
The sample I posted:
userEntry.Invoke("ChangePassword", new object[] { currentPassword, newPassword });
Can you spot the difference?
The method is called ChangePassword , NOT ChangeUserPassword . That's why you're getting an exception telling you that the method you've tried to invoke is unknown.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi friends,
I need help to implement functionality of MULTIPLE.OPERATIONS which is there in excel into .net.
|
|
|
|
|
Do you have a question?
Raghavendra.Kodimala wrote: MULTIPLE.OPERATIONS Why is this all CAPITALS and why is there a period in it?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|