Search Results

Search found 4334 results on 174 pages for 'sender'.

Page 84/174 | < Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >

  • Asp.net: Replace GenericPrincipal

    - by Pickels
    Hello, I was wondering what the best way is to replace the genericPrincipal with my own CustomGenericPrincipal. At the moment I have something like this but I aint sure if it's correct. protected void Application_AuthenticateRequest(Object sender, EventArgs e) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); var identity = new CustomIdentity(authTicket); var principal = new CustomPrincipal(identity); Context.User = principal; } else { //Todo: check if this is correct var genericIdentity = new CustomGenericIdentity(); Context.User = new CustomPrincipal(genericIdentity); } } I need to replace it because I need a Principal that implements my ICustomPrincipal interface because I am doing the following with Ninject: Bind<ICustomPrincipal>().ToMethod(x => (ICustomPrincipal)HttpContext.Current.User) .InRequestScope(); So what's the best way to replace the GenericPrincipal? Thanks in advance, Pickels

    Read the article

  • MediaElement.Position behaviour and Windows Phone 7 issue

    - by RoguePlanetoid
    I have a problem, I have written a simple Media Player for Windows Phone 7 and can Play, Stop and control the Volume of a Video (loaded from a URI) however when I try to set the position, this causes the application to freeze. I have used both these lines, but either does not work: Player.Position = new TimeSpan(0, 0, 0, 0, (int)Position.Value); Player.Position = TimeSpan.FromSeconds((int)(Position.Value)); I do have this event handler: void Player_MediaOpened(object sender, RoutedEventArgs e) { Position.Maximum = Player.NaturalDuration.TimeSpan.TotalMilliseconds; } And have tried using the Seconds value, casting to Ints etc, however everytime I try to set the Position, the app freezes. The video otherwise plays normally - anyone know what the problem may be here?

    Read the article

  • Saving a single NSMutableDictionary in a plist

    - by yesimarobot
    I have one dictionary I need to save into a plist. The paletteDictionary always returns nil: - (void)saveUserPalette:(id) sender { [paletteDictionary setObject:matchedPaletteColor1Array forKey:@"1"]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"UserPaletteData.plist"]; // write plist to disk [paletteDictionary writeToFile:path atomically:YES]; } I'm reading the data back in a different view like: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"UserPaletteData.plist"]; NSMutableDictionary *plistDictionary = [NSMutableDictionary dictionaryWithContentsOfFile:path]; if(plistDictionary==nil ){ NSLog(@"failed to retrieve dictionary from disk"); }

    Read the article

  • cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]'

    - by user1576628
    I'm pretty new to C++/CLI and I am trying to convert a System::String to a System::Char array. Here's what I have so far: private: System::Void modeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) { Mode frmMode; if(frmMode.ShowDialog() == System::Windows::Forms::DialogResult::OK){ array <Char>^ load [] = gcnew array<Char>(txtbxName->Text->ToCharArray()); } } txtbxName is a textbox inside a the form. Supposedly, this should work, but I get the compiler error: error C2440: cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^[]' for the fourth line of the snippet.

    Read the article

  • Blacklight Expander problem while expanding programmatically

    - by David Brunelle
    Hi, I am doing a silverlight project in Silverlight 4 and I included the BlackLight project in my project so that I could use their new controls, especialy the dockpanel and the autoexpander, which is causing me at the moment some little problems. What I would like to do is to have several auto-expander that will expand or collapsed when I click on button. In my case more specifically, each auto-expander have a set of parameter to fill, which in turn will fill the other expander and the current one would collaps and the just filled one would expand. The idea is simple, yet when I use a button which is on one of my expander, it only works once... It would expand/collapse the first time, then after that, nothing. I trace the code and it seems to go through just fine, but the property value won't change Here is my code Private Sub BtnExpand_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles BtnExpand.Click ClientExpander.IsExpanded = False ProjetExpander.IsExpanded = True End Sub Could it be a known bug, or must I reset some flags to make it work? Thanks.

    Read the article

  • How can i navigate one xaml page to another?

    - by programmerist
    i have 2 page i need to navigate mainpage.xaml to login.page xaml but it throws me Object reference not set to an instance of an object. in Root.Children.Clear();.... i added this codes in App.xaml: private void Application_Startup(object sender, StartupEventArgs e) { Grid myGrid = new Grid(); myGrid.Children.Add(new MainPage()); this.RootVisual = myGrid; } and than i adde some codes on main.xaml to navigate to LoginUI.xaml namespace Gen.CallCenter.UI { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); Grid Root = ((Grid)(this.Parent)); Root.Children.Clear(); Root.Children.Add(new LoginUI()); } } } How can i navigate main.xaml to LoginUI.xaml ?

    Read the article

  • Errorprovider shows error on using windows close button(X)

    - by Pankaj Kumar
    Hi guys, Is there any way to turn the damned error provider off when i try to close the form using the windows close button(X). It fires the validation and the user has to fill all the fields before he can close the form..this will be a usability issue because many tend to close the form using the (X) button. i have placed a button for cancel with causes validation to false and it also fires a validation. i found someone saying that if you use Form.Close() function validations are run... how can i get past this annoying feature. i have a MDI sturucture and show the form using CreateExam.MdiParent = Me CreateExam.Show() on the mdi parent's menuitem click and have this as set validation Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating If String.IsNullOrEmpty(TextBox1.Text) Then Err.SetError(TextBox1, "required") e.Cancel = True End If If TextBox1.Text.Contains("'") Then Err.SetError(TextBox1, "Invalid Char") e.Cancel = True End If End Sub Any help is much appreciated. googling only showed results where users were having problem using a command button as close button and that too is causing problem in my case

    Read the article

  • BAD_UID error while exporting key in CryptoAPI

    - by mindthief
    Hi all, I am writing a test application for Microsoft CryptoAPI. I want to export the secret key of one party using the public key of the second party, and then import that secret key as the second party's secret key (this sets up a shared secret key for communication). Here is my code: if(!CryptExportKey(encryptT->hSymKey, decryptT->hPubKey, SIMPLEBLOB, 0, keyExBuf, &bufLen)) { FormattedDebugPrint(NULL, GetLastError(), "could not export secret key", TRUE); return -1; } if(!CryptImportKey(decryptT->hCryptProv, keyExBuf, bufLen, decryptT->hPubKey, 0, &(decryptT->hSymKey))) { FormattedDebugPrint(NULL, GetLastError(), "could not import secret key", TRUE); return -1; } And this gives the error: 80090001: Bad UID. The public keypair is being generated for both encryptT and decryptT (sender, receiver) by calling: CryptGenKey(encryptT->hCryptProv, CALG_RSA_KEYX, CRYPT_EXPORTABLE, &(encryptT->hPubKey)) Any idea what could be causing the error? Thanks,

    Read the article

  • sorting and paging with gridview asp.net

    - by dangerisgo
    I'm trying to get a gridview to sort and page manually with no success. The problem is that when a user clicks the column they want to sort, it sorts that page, but doesn't sort the datasource (dataview) behind the gridview. So when they progress to a different page, their sort is lost. Pretty much I'm looking for a sort that will actually sort the datasource behind the gridview. Here is what I have so far: protected void GridView_OnSort(object sender, GridViewSortEventArgs e) { String sortExpression = e.SortExpression; if (GridViewSortDirection == SortDirection.Ascending) { DataView myDataView = new DataView(mybll.GetItemsOrdered()); myDataView.Sort = sortExpression + " DESC"; GridView.DataSource = myDataView; GridView.DataBind(); } else { DataView myDataView = new DataView(mybll.GetItemsOrdered()); myDataView.Sort = sortExpression + " ASC"; GridView.DataSource = myDataView; GridView.DataBind(); } } Any help would be appreciated. Thanks.

    Read the article

  • webclient and expect100continue

    - by chandra
    What is the best way to set expect100continue when using WebClient(C#.NET). I have this code below, I still see 100 continue in the header. Stupid apache still complains with 505 error. string url = "http://aaaa.com"; ServicePointManager.Expect100Continue = false; WebClient service = new WebClient(); service.Credentials = new NetworkCredential("username", "password"); service.Headers.Add("Content-Type","text/xml"); service.UploadStringCompleted += (sender, e) => CompleteCallback(BuildResponse(e)); service.UploadStringAsync(new Uri(url), "POST", query);

    Read the article

  • C# WinForms problem with draw image

    - by Paul
    Hi I have this class: class OriginalImage: Form { private Image image; private PictureBox pb; public OriginalImage() { pb = new PictureBox {SizeMode = PictureBoxSizeMode.CenterImage}; pb.SizeMode = PictureBoxSizeMode.StretchImage; Controls.Add(pb); image = Image.FromFile(@"Image/original.jpg"); this.Width = image.Width; this.Height = image.Height; this.Text = "Original image"; this.Paint += new PaintEventHandler(Drawer); } public virtual void Drawer(object source, PaintEventArgs e) { Graphics g = pb.CreateGraphics(); g.DrawImage(image,0,0); } I call this create object OriginalImage in other form on button click, but image is not draw? Where is problem? public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { var oi = new OriginalImage(); oi.Show(); } }

    Read the article

  • WinForms Taskbar Icon - Click Event not firing

    - by Greycrow
    I have created a non-form c# program that uses the NotifyIcon class. The text "(Click to Activate)" shows up when I hover the mouse. So I am getting some events handled. However, The "Click" event does not fire and the Context menu doesnt show up. public class CTNotify { static NotifyIcon CTicon = new NotifyIcon(); static ContextMenu contextMenu = new ContextMenu(); static void Main() { //Add a notify Icon CTicon.Icon = new Icon("CTicon.ico"); CTicon.Text = "(Click to Activate)"; CTicon.Visible = true; CTicon.Click += new System.EventHandler(CTicon_Click); //Create a context menu for the notify icon contextMenu.MenuItems.Add("E&xit"); //Attach context menu to icon CTicon.ContextMenu = contextMenu; while (true) //Infinite Loop { Thread.Sleep(300); //wait } } private static void CTicon_Click(object sender, System.EventArgs e) { MessageBox.Show("Clicked!"); } }

    Read the article

  • Out of memory with multi images in one picturebox

    - by Nikom
    Hi, ive problem with out of memory when im trying load few images into one picturebox. Pls Help :) public void button2_Click(object sender, EventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.ShowDialog(); string selected = dialog.SelectedPath; string[] imageFileList = Directory.GetFiles(selected); int iCtr = 0,zCtr = 0; foreach(string imageFile in imageFileList) { if (Image.FromFile(imageFile) != null) { Image.FromFile(imageFile).Dispose(); } PictureBox eachPictureBox = new PictureBox(); eachPictureBox.Size = new Size(100,100); // if (iCtr % 8 == 0) //{ // zCtr++; // iCtr = 0; //} eachPictureBox.Location = new Point(iCtr * 100 + 1, 1); eachPictureBox.Image = Image.FromFile(imageFile); iCtr++; panel1.Controls.Add(eachPictureBox); } }`enter code here`

    Read the article

  • How can I set up .NET UnhandledException handling in a Windows service?

    - by Mike Pateras
    protected override void OnStart(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.Sleep(10000); throw new Exception(); } void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { } I attached a debugger to the above code in my windows service, setting a breakpoint in CurrentDomain_UnhandledException, but it was never hit. The exception pops up saying that it is unhandled, and then the service stops. I even tried putting some code in the event handler, in case it was getting optimized away. Is this not the proper way to set up unhandled exception handling in a windows service?

    Read the article

  • asp.net postback with jquery?

    - by mark smith
    Hi there, Can anyone help, I have a asp.net button but recently replaced it with a standard html button ... What i need to do is postback to an asp.net page and ensure a method is called the button before was an asp.net button so i had this event Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) UtilTMP.DisposeObjects() Server.Transfer("~\Forms\test.aspx", True) End But i was using a button with javascript ALERT and recently changed to Jquery UI Model dialog but it doesn't wait for me to answer the question.. the postback happenes immediatly ... so i decided to change to a standard HTML button ... but i need to postback to the asp.net page and call a method like. If i just postback it won't call the cleanup Protected Sub Cleanup() UtilTMP.DisposeObjects() Server.Transfer("~\Forms\test.aspx", True) End

    Read the article

  • RadControl DateTimePicker Selecting new time doesn't remove highlight from previous selection

    - by Jason Beck
    This is not browser specific - the behavior exists in Firefox and IE. The RadControl is being used within a User Control in a SiteFinity site. Very little customization has been done to the control. <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" MinDate="2010/1/1" Width="250px"> <ClientEvents></ClientEvents> <TimeView starttime="08:00:00" endtime="20:00:00" interval="02:00:00"></TimeView> <DateInput runat="server" ID="DateInput"></DateInput> </telerik:RadDateTimePicker> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { RadDateTimePicker1.MinDate = DateTime.Now; } }

    Read the article

  • WPF -- Event Threading, GUI updating question

    - by LSTayon
    I'm trying to send two events to the main window so that I can show some kind of animation that will let the user know that I'm updating the data. This is an ObservableCollection object so the OnPropertyChanged is immediately picked up by the bindings on the main window. The sleep is only in there so that the user can see the animation. However, the first OnPropetyChanged is never seen. I'm assuming this is because we're in a single thread here and the timer_Tick has to finish before the GUI updates. Any suggetions? In VB6 land we would use a DoEvents or a Form.Refresh. Thanks! private void timer_Tick(object sender, EventArgs e) { Loading = "Before: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); LoadData(); Thread.Sleep(1000); //Loading = Visibility.Hidden; Loading = "After: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); }

    Read the article

  • After minimizing app, on restore, windows pursues mouse pointer

    - by Nuno Silva
    Hi! I have an application in WPF C# where other than the purpose of what it's done, I customized the close and minimize buttons. The problem is that when I minimize, all is good, I cycle around all other apps, but, when I want to go back to the application, I click in the window in the taskbar, and the window pops up... But when it pops up, the window pursues the mouse pointer throughout the screen... The code i've implemented the the simplest it can be... private void Minimize_LeftMouseDown(object sender, MouseButtonEventArgs e) { this.WindowState = WindowState.Minimized; } Can you point me some directions? Thanks

    Read the article

  • LINQ error when deployed - Security Exception - cannot create DataContext

    - by aximili
    The code below works locally, but when I deploy it to the server it gives the following error. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. The code is protected void Page_Load(object sender, EventArgs e) { DataContext context = new DataContext(Global.ConnectionString); // <-- throws the exception //Table<Group> _kindergartensTable = context.GetTable<Group>(); Response.Write("ok"); } I have set full write permissons on all files and folders on the server. Any suggestions how to solve this problem? Thanks in advance.

    Read the article

  • ListBoxItem.Parent returns nothing, unable to get it thru VisualTreeHelper.GetParent either

    - by Shimmy
    How do I extract the parent container of a ListBoxItem? In the following example I can go till the ListBoxItem, higher than that I get Nothing: <ListBox Name="lbAddress"> <ListBox.ItemTemplate> <DataTemplate> <Button Click="Button_Click"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Private Sub Button_Click(sender As Button, e As RoutedEventArgs) Dim lbAddress = GetAncestor(Of ListBox) 'Result: Nothing End Sub Public Shared Function GetAncestor(Of T)(reference As DependencyObject) As T Dim parent = GetParent(reference) While parent IsNot Nothing AndAlso Not parent.GetType.Equals(GetType(T)) parent = GetAncestor(Of T)(parent) End While If parent IsNot Nothing Then _ Return If(parent.GetType Is GetType(T), parent, Nothing) Return Nothing End Sub Public Function GetParent(reference As DependencyObject) As DependencyObject Dim parent As DependencyObject = Nothing If TypeOf reference Is FrameworkElement Then parent = DirectCast(reference, FrameworkElement).Parent ElseIf TypeOf reference Is FrameworkContentElement Then parent = DirectCast(reference, FrameworkContentElement).Parent End If Return If(parent, VisualTreeHelper.GetParent(reference)) End Function Update This is what happens (note that the 'parent' variable remains null):

    Read the article

  • Add WhereParameters to LinqDataSource in Selecting event

    - by Steven
    I have a repeater using a LinqDataSource as a data source. When a query string is entered, I'd like to filter the results, but ONLY when a query string is entered. If there is no query string, the results should not be filtered, all results should be returned. I'm trying to add a WhereParameter to my LinqDataSource in the Selecting event of the LinqDataSource, but it's not working. Here's my code: protected void ldsImages_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (Request.QueryString["id"] != null) { e.WhereParameters.Add("ImageTypeID", Request.QueryString["id"]); } }

    Read the article

  • How to Edit NSF file using c#?

    - by Preeti
    Hi, I want to programaticaly change some values to NSF item and then want to save it.(i.e to edit NSF File and then save the editions) for example: I want to set Sender name of all mails to "[email protected]".(Using Domino.dll). Solution I tried: (Swaping of To and From values) String Temp_From = ((object[])docInbox.GetItemValue("From"))[0] as String; String Temp_SendTo = ((object[])docInbox.GetItemValue("SendTo"))[0] as String; docInbox.ReplaceItemValue("From", Temp_SendTo); docInbox.ReplaceItemValue("SendTo", Temp_From); docInbox.Save(true, false, false); /* Applied for following fields also: For From: AltFrom,DisplayFrom,DisplayFrom_2,dspFrom,ForwardedFrom,INetFrom,tmpDisplayFrom For To : displaySendTo,EnterSendTo,Envelope_to,tmpDisplaySendTo Also Tried for saving : docInbox.Save(true, true, true); */ In above code after successful editing changes values are not reflected in Nsf File. But when i am reading edited Nsf (copying modified file on different location ) file programatically it is showing changed values.(Why changes are not visible here ?)

    Read the article

  • Send an email using python script

    - by nimmyliji
    Hi, Today I needed to send email from a Python script. As always I searched Google and found the following script that fits to my need. import smtplib SERVER = "localhost" FROM = "[email protected]" TO = ["[email protected]"] # must be a list SUBJECT = "Hello!" TEXT = "This message was sent with Python's smtplib." # Prepare actual message message = """\ From: %s To: %s Subject: %s %s """ % (FROM, ", ".join(TO), SUBJECT, TEXT) # Send the mail server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, message) server.quit() But when I tried to run the program, I got the following error message: Traceback (most recent call last): File "C:/Python26/email.py", line 1, in <module> import smtplib File "C:\Python26\lib\smtplib.py", line 46, in <module> import email.utils File "C:/Python26/email.py", line 24, in <module> server = smtplib.SMTP(SERVER) AttributeError: 'module' object has no attribute 'SMTP' How can i solve this problem? Any one can help me? Thanks in advance, Nimmy.

    Read the article

  • how to dinamically add controls in asp.net Dynamic Data

    - by loviji
    Hello, i'm trying to work with asp.NET Dynamic Data. So, I see Dynamic Data not well learned by people as other technologies. now, to my question. Lets us work with Details.aspx page that located on ~\DynamicData\PageTemplates I need to add <asp:DynamicControl runat="server" to page into Form1.detailsTable. i've tried like this: protected DynamicControl myC=new DynamicControl(); protected void Page_Load(object sender, EventArgs e) { foreach(var c in table.Columns) { myC.DataField=c.DisplayName; FormView1.Controls.Add(myC); } } but I can not see the desired result. where is the problem. thanks

    Read the article

  • i am facing some problem while passing parameter to crystal report? it is asking for the password of

    - by Gaurav Sharma
    protected void Page_Load(object sender, EventArgs e) { ConnectionInfo myConnectionInfo = new ConnectionInfo(); myConnectionInfo.UserID = "sa"; myConnectionInfo.Password = "********"; setDBLOGONforREPORT(myConnectionInfo); //When i don't write this code it does not ask for the passowrd //but doesn't take Parameter as value int recpt_no = Convert.ToInt32(Request.QueryString["recpt_no"]); ReportDocument report1 = new ReportDocument(); //report1.SetDatabaseLogon("sa", "********"); report1.Load(Server.MapPath("purchase.rpt")); report1.FileName = Server.MapPath("purchase.rpt"); report1.SetParameterValue("recpt_no", recpt_no); CrystalReportViewer1.ReportSource = report1; } private void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo) { TableLogOnInfos mytableloginfos = new TableLogOnInfos(); mytableloginfos = CrystalReportViewer1.LogOnInfo; foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos) { myTableLogOnInfo.ConnectionInfo = myconnectioninfo; } } kindly Help me as soon as possible respt_no is passed as querysting Gaurav Sharma

    Read the article

< Previous Page | 80 81 82 83 84 85 86 87 88 89 90 91  | Next Page >