|
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.
|
|
|
|
|
This is functionality exist in tools menu in libreoffice. We can apply on set of fields. Any one who uses excel, can understand what am i asking
|
|
|
|
|
Raghavendra.Kodimala wrote: This is functionality exist in tools menu in libreoffice 1. You posted in the ASP.Net forum.
2. You then mentioned Excel.
3. Now you are mentioning Libre Office.
Can you see why this is confusing?
Raghavendra.Kodimala wrote: Any one who uses excel, I've used every version since 1995 and have no idea what you are asking. Rather than be rude, can you ask a clear question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
I understood the what if analysis and concept of Multiple operations. But my exact requirement is i want to write a function with few parameters. In that first parameter is need to capture formula assigned to a variable. How can we write that?
|
|
|
|
|
This is the ASP.NET forum and it is far from clear what your problem is. Where and how do you plan to create this code? And indeed, what programming language you are talking about?
|
|
|
|
|
My problem is I am working on a new ASP.NET application where existing application is libreoffice. (Since it's also spread sheet, I am using term excel some times). In this libreoffice, I have encountered a function in a formula called MULTIPLE.OPERATIONS. I have studied about this function. It is not exactly a function, but it comes under what if analysis. This is in tools menu (libreoffice). I need to write a function in .net which behaves as MULTIPLE.OPERATIONS. There i got stucked and asking for help.
I am sorry if anybody takes rude or rash behavior from my written content.
|
|
|
|
|
Raghavendra.Kodimala wrote: I need to write a function in .net which behaves as MULTIPLE.OPERATIONS. Then you need to explain what this function is supposed to do, and exactly where you are stuck. You also need to explain how and where this fits into an ASP.NET application.
|
|
|
|
|
I already given explanation about this method. Again am explaining. This method consists three parameters. First parameter takes formula assigned to a variable. Second parameter takes the variable which need to be replaced in captured formula(first parameter). This function replaces second parameter in formula with third parameter which is also a variable. If second parameter not found in the captured formula, then function searches for second parameter variable in all variables formulas in the captured formula until it finds the second parameter variable. Then replaces with third parameter.
|
|
|
|
|
Hi Friends. I have done my project in asp.net with using webmethod concepts. I deployed it in live server. Clients are using windows 8 with IE 11/9. When users used my projects then IE version are changed to IE7. webmethod and json does not support IE 7/8. but when this page open then its automatically IE version changed and display 'JSON object' error. I tried to changed IE default version 9.but its automatically changed IE 7/8. how to change IE default version 9. what is the solution for my problem? Give me your suggestions.
|
|
|
|
|
It sounds like your headers are sent to IE7 compatibility.
Check the template page (your index.html/aspx/whatever) and make sure that the compatibility header is set correctly. For instance, for IE 9:
<head>
...
<meta http-equiv="X-UA-Compatible" content="IE=9" />
...
</head>
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
I also use this meta header name. But no use.
|
|
|
|
|
You did not say what the problem is !
|
|
|
|
|
Hi,
My problem is IE default version are automatically changed IE Edge to IE 7. But I want IE default version 9. How to changed default version of IE 9?
|
|
|
|
|
CAn you post your Meta tags.
|
|
|
|
|
|
You need to check few things here. If your application does not set to IE7 deliberately then why would browsers change to IE7, which means you dont have to set the compatibility meta tag at all.
It raises the second question which is by setting the meta tag to IE9 why wouldn't browers obey it.
My answer to the first question is, can you please check that your application doesn't alter browser's default beahviour deliberately.
Answer to the second question is that check your web.config and make sure that the correct meta tag is passed to the pages. Also check the 'view source' HTML in the browser rather than taking it from your source code.
Hope this helps.
|
|
|
|
|
I'm new to ASP, but not c#.
The fileupload control seems to be different than the rest of my controls, I cannot seem to link it to my c# code.
Do I need to create an event listener for it? Or a background worker process thread to monitor something from it?
I'm sure this is caused by me not understanding how the html and c# code work. How can I communicate between the fileupload control and my c sharp code in the background? I tried to put a javascript function into the head portion but it does not appear to be called and when I put a break point in there to test it, it does not hit the break point.
Thanks
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="True"
CodeBehind="Default.aspx.cs" Inherits="exchangePictureUpdater.exchangePictureUpdater" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script src="jquery-2.2.4.js"></script>
<script>
function loadimage() {
alert($("#thefile").prop('files'));
}
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imgBox')
.attr('src', e.target.result)
<%--.width(150)
.height(200); --%>
$("#<%=tbxPictureHeight.ClientID %>").val("");
$("#<%=tbxPictureWidth.ClientID %>").val("");
$("#<%=tbxPictureFileSize.ClientID %>").val("");
$('#imgBox').on('load', function () {
var height = this.naturalHeight,
width = this.naturalWidth;
$("#<%=tbxPictureHeight.ClientID %>").val(height);
$("#<%=tbxPictureWidth.ClientID %>").val(width);
var imgpath = document.getElementById('theFile');
//if (!imgpath.value==""){
//var img=imgpath.files[0].size;
//var imgsize=img/1024;
//alert(imgsize);
//$("#<%=tbxPictureFileSize.ClientID %>").val(imgsize);
});
};
reader.readAsDataURL(input.files[0]);
}
}
//function btnAddReplace_Click() {
// alert($("#imgBox").prop('src'));
//}
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Button ID="btnResolvePin" runat="server" Height="29px" Text="Resolve Pin" Width="160px" OnClick="btnResolvePin_Click" />
<asp:TextBox ID="tbxPinName" runat="server"></asp:TextBox>
<asp:DropDownList ID="ddlDomains" runat="server">
<asp:ListItem Value="1"></asp:ListItem>
<asp:ListItem Value="2"></asp:ListItem>
<asp:ListItem Value="3"></asp:ListItem>
<asp:ListItem Value="4"></asp:ListItem>
<asp:ListItem Value="5"></asp:ListItem>
<asp:ListItem Value="6"></asp:ListItem>
<asp:ListItem Value="7"></asp:ListItem>
<asp:ListItem Value="8"></asp:ListItem>
</asp:DropDownList>
<br />
<asp:Label ID="lblUserResolvedName" runat="server" Text="User Resolved Name"></asp:Label>
<asp:TextBox ID="tbxUserName" runat="server" ReadOnly="True" Width="354px"></asp:TextBox>
<asp:Button ID="btnTest" runat="server" Height="29px" OnClick="btnTest_Click" Text="Test" />
<br />
<br />
<asp:Label ID="lblBrowseForPicture" runat="server" Text="Browse For Picture"></asp:Label>
<asp:Label ID="lblPictureHeight" runat="server" Text="Picture Height"></asp:Label>
<asp:Label ID="lblPictureWidth" runat="server" Text="Picture Width"></asp:Label>
<asp:Label ID="lblPictureFileSize" runat="server" Text="File Size"></asp:Label>
<br />
<asp:FileUpload ID="thefile" runat="server" onchange="readURL(this);" itemid="thefile" value="thefile" Width="347px" />
<asp:TextBox ID="tbxPictureHeight" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
<asp:TextBox ID="tbxPictureWidth" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
<asp:TextBox ID="tbxPictureFileSize" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
<asp:Label ID="lblPictureFileSizeInKBs" runat="server" Text="KB's"></asp:Label>
<br />
<br />
<asp:Button ID="btnViewPicture" runat="server" Height="29px" OnClick="btnViewPicture_Click" Text="View Picture" Width="160px" />
<br />
<br />
<asp:Button ID="aspbtnAddReplace" runat="server" Height="29px" OnClick="btnAddReplace_Click" text="Add/Replace Picture" Width="160px" />
<br />
<br />
<asp:Button ID="btnDelete" runat="server" Height="29px" OnClick="btnDelete_Click" Text="Delete Picture" Width="160px" />
<br />
<br />
<asp:Button ID="btnSavePicture" runat="server" Height="29px" OnClick="btnSavePicture_Click" Text="Save Picture" Width="160px" />
<br />
<br />
<asp:Button ID="btnClearPicture" runat="server" Height="29px" OnClick="btnClearPicture_Click" Text="Clear Picture" Width="160px" />
<br />
<br />
<asp:Image ID="imgBox" runat="server" ImageUrl='<%# "data:image/jpg;base64," + Convert.ToBase64String((byte[])Eval("IMG_DATA")) %>' />
<asp:Panel ID="DialogControl" Visible="false" runat="server" style="position:absolute;width:200px;height:150px;top:200px;right:300px;border:thick;z-index:100" BackColor="Red" BorderColor="Black" BorderStyle="Solid" BorderWidth="5px">
<asp:Literal ID="DialogContent" runat="server"></asp:Literal><br />
<asp:Panel id="buttonpanel" runat="server" style="text-align: center; position:relative;" Height="100%" Width="100%" BackColor="Red" >
<asp:Button ID="DialogOKButton" runat="server" Text="OK" OnClick="DialogOKButton_Click" style="text-align: center; position: absolute; bottom:0;"/>
</asp:Panel>
</asp:Panel>
</asp:Content>
|
|
|
|
|
To the best of my knowledge, you just listen for the file upload event.
In MVC, I wrote a new way of uploading a file, or multiple files at the same time.
I used JQuery to listen for the DOM event "change"; file upload button, and ran a JQuery function to intercept the upload and target the data to a JsonResult in one of my controllers, an Ajax controller.
Sounds weird huh?. But I will show 2 examples, MVC and Webforms. I believe this is the secret to Uploadify.
JQuery: in the document ready, I listened for the upload button to fire an event to upload the file stream, which is just a base64 string representing bytes. So this validates the name of the files, and then runs the function
$("#AvatarBrowse").on("change", function (e) {
if (validate_upload_brandAvatar()) {
run_upload_brandAvatar(e, $(this));
}
});
JQuery: This intercepts the file upload, but passes extra data along with the page event.
var _extraData = "?id=-1&avatarName=" + _avatarName + "&avatarAlt=" + _avatarAlt;
if (window.FormData !== undefined) {
var _data = new FormData();
for (var x = 0; x < _files.length; x++) {
_data.append("file" + x, _files[x]);
}
$.ajax({
type: "POST",
url: '/Ajax/json_upload_brand_avatar' + _extraData,
contentType: false,
processData: false,
data: _data,
Then in my Ajax Controller, its an Async Task<<JsonResult>>
This grabs the file content in the base64 string of bytes, and converts the string to a byte array to save in the database. Then it processes the image, and sends back a base64 string of the image to preview after changes.
var fileContent = Request.Files[file];
if (fileContent != null && fileContent.ContentLength > 0)
{
using (MemoryStream stream_in = new MemoryStream())
{
fileContent.InputStream.CopyTo(stream_in);
string oFileName = fileContent.FileName;
string oFileExt = Path.GetExtension(oFileName);
string fileName = cleanInput.Clean_FileName(avatarName.ToLower() + oFileExt);
var path = Path.Combine(Server.MapPath("~/Images/avatars/departments"), fileName);
On webforms, it's a different process.
you use the IHTTPHandler and ProcessRequest to intercept the file upload. I wrote this in VB, I just started writing in c#. This uses uploadify to upload the file, and the function below intercepts the upload from the browser, captures the post to the server.
Public Class Admin_Management_ckEditor_Upload
Inherits System.Web.UI.Page
Implements IHttpHandler
Implements IRequiresSessionState
Public Overrides Sub ProcessRequest(ByVal context As HttpContext)
Dim Exception_Message As String = Nothing
Try
Dim vFlag As Boolean = False
Dim m_Context As HttpContext = HttpContext.Current
Dim m_file As HttpPostedFile = m_Context.Request.Files("upload")
If Not (m_file Is Nothing) Then
'Get the Uploaded file information from the file object
Dim m_fileName As String = m_file.FileName
Dim m_fileSize As Integer = m_file.ContentLength
Dim m_fileContent As String = m_file.ContentType
Basically in a nut shell, the browser will post the file to the server, you just need something to intercept the post and do something with it. I find once again that MVC is much more easier to work with and requires much less code.
Knowing now that the upload is just a base64 string of bytes, it's much easier for me to comprehend what is happening, and turn that string of bytes into a byte array to save in the database or to write out as a file. I choose to funnel that byte array into an image processor that I wrote, posted in a previous post here, to further process the image and return the byte array back, using my Ajax controller function. I sent it back as a base64 string to the page so the processed image can be previewed and saved.
I don't expect you to just pick on this and run with it, but its enough information for you to search in the right direction towards your goal. I don't remember a simpler way of doing it anymore. It's one of those things that you write once and keep using over and over.
|
|
|
|
|
You don't have any c# code that is interacting with the file upload so you might need to explain your problem better, and maybe be more explicit about the language you use, eg javascript isn't c#, are you trying to interact on the client or the server, and so on.
|
|
|
|
|
Dear All,
Can you please suggest me how to open specific url in Chrome Browser from asp.net Iframe.
|
|
|
|