.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Impersonation while using I frame

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
Hi there...I have a page whith a few buttons (each button is a SSRS report.) and then in the code behind of the button i set the Src attribute of the IFrame (that is on the same page) = the URL of the SSRS Report. The problem is that everytime it tells me that user (domain/MyAccount) does not have sufficient access. SSRS uses AD Authentication to authenticate the user. The server account has access to SSRS Reports and when i view the web Page on the server it self or log on as the Server Account User then the reports show but when i run it from my computer (logged on as MySelf) then the reports does not show. What can i do to show the reports regardless of who the user is that requests them? I am trying to use Impersonation but clearly i am doing something wrong.I do the Impersonation and then check the following variablesEnviroment.UserName = Server Account (Correct)Page.User.Identity.Name = Server Account (Correct)Now that the Impersonation is done i set the iFrame's SRC. But it gives me the error mentioned above. I used the code thats mentioned on Rick Sthals web Bloghttp://www.west-wind.com/weblog/posts/1572.aspxCan someone give me some direction as to where my problem is?Thank you.

View Complete Post

More Related Resource Links

Wrong Account being used to access files - Help - No Impersonation


I run a simple .aspx website on a Windows Server 2008 machine.

There is NO impersonation, and System.Security.Principal.WindowsIdentity.GetCurrent().Name returns NT AUTHORITY\NETWORK SERVICE, which it the account which the application pool runs. In my web.config, I have <authentication mode="Forms">.


I tried to test the security of the application and server by removing file permissions to the .aspx files. I was greatly worried when the website continued to run without problem (it should not have been able to read the .aspx files).

By turning on file level auditing, I discovered that the .aspx files were being read by the machine$ account (if the machine is called Serv1, then the files would be read by the Serv1$ account, which seems to have access to all files on the local machine).


Is this a security breach or is this behaviour by design ?

Please can somebody assist, as I am worried.

Update net frame 3.5.


I use visual studio 2008 but It's only use net frame work 2.0, Can I update and use net frame work 3.5 for Visual Studio 2008 ? Please help me !


Is master page a best alternative for Frame Sets ??


My webpage has one banner with a logo, a vertical menu bar on the left side of the page and a footer . I have 5 other pages which should get loaded when the user select them from the menu bar. what my concern is actually the banner,  menu bar  and the footer should not change when the requested page loads. This definitely can be handled by sets. But I want to know whether there are any other alternatives for frame sets or could master page be helpful for this purpose ????? 

Any help would be appreciative .

Search Webservice Impersonation









We are looking for some help with Impersonated SharePoint Search.

We are trying to execute a search with a given user and having no luck.


We have tried the methods in this article and it’s not hiding results that the user does not have access to.

How to draw editable controls on Windows Vista Glass Frame?

I have a form that is set completely transparent with DwmExtendFrameIntoClientArea API, the issue am facing is when i have editable controls (ComboBox) on the forum the editable part goes transparent the text on the ComboBox is no more visible, i found a solution for the same issue at the following link  http://weblogs.asp.net/kennykerr/archive/2006/08.aspx However it doesnt works, and i read somthing on another web that this soultoin will not work on RC1, or i might be missing some thing, Any help or reference to resolve the issue in C# would be appreciated,   Regards Vallarasu S.

Error in Impersonation - different domain account.

Hi I am trying to stop a windows service in a server(on different domain) from my C#.NET windows application using ServiceController I am getting following error Inner Exception: {"Access is denied"} Exception Message: "Cannot open Service Control Manager on computer 'x.y.z.a'. This operation might require other privileges." Enviroment:       Windows application running on Windows 7, C#.NET, 3.5 on “ABC” DOMAIN       Target service running on Windows 2003 server. on “XYZ” DOMAIN       Port 445,135 opened between two systems Code:       ServiceController lo_WinSC = new ServiceController();       lo_WinSC.MachineName = "SYSTEMIPAddress";       lo_WinSC.ServiceName = "ServiceToBeStopped"; Some forum suggesting to impersonate account of target domain but failed to Impersonate. Error: “The security database on the server does not have a computer account for this workstation trust relationship”   Question 1: Is it possibile to impersonate account of different domain. i.e My application running on “XYZ” domain, I would like to impersonate an account “ABC” domain. Note: Port LDAP port 389 is opened between two systems. Is possb

No symbols are loaded for any call stack frame. The source code cannot be displayed.

Hello.I installed VisualStudio.NET 2005 a few days ago.  ( not beta )While I'm debugging, I'm faced with strange message box.-- MessageBox --No symbols are loaded for any call stack frame. The source code cannot be displayed. -- Debug Detail Window --FatalExecutionEngineError was detectedMessage: The runtime has encountered a fatal error. The address of the error was at 0x7a2b5aec, on thread 0x358. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.How should I solve this problem?Please answer me..Thanks.Gwisun.

Active Directory user impersonation with forms authentication

I've written a small ASP.NET 3.5 application to allow users to update selected account attributes on their own. Everything works fine when I use Basic Authentication, but because the dialog that is presented is less than ideal, I'd like to use forms authentication to give the users more instruction on how to log in. My problem is that in order for the user to update their account information, I have to have the application impersonate them for the update actions. I've scoured the internet trying to find a solution to my issue, but nothing fits or works. I have tried setting the web.config:<identity impersonate="true" /> but that doesn't seem to work. I also have the C# code using the WindowsImpersonationContext class, but still no luck. protected void titleTextBox_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; string fieldTitle = "job title"; string fieldName = "title"; if (userDirectoryEntry == null) CaptureUserIdentity(); try { WindowsImpersonationContext impersonationContext = userWindowsIdentity.Impersonate(); if (String.IsNullOrEmpty(tb.Text)) userDirectoryEntry.Properties[fieldName].Clear();

Documentation on impersonation of Windows LiveID with data service?

Hi There, I'm not finding any documentation on impersonating a Windows LiveID over a WCF data service. I can find documentation on Windows Auth. For example, this article is great, but its first step is "Configure Your Service to Use Windows Authentication": http://geekswithblogs.net/manesh/archive/2009/04/23/setting-up-wcf-to-impersonate-client-credentials.aspx. I'm not sure how to do this when I'm working with the LIVEID. Alternatively, and even preferably, if there's a way I can manipulate the connection string the data service is using from the WCF endpoint, that would be ideal. I need to grab some info about the user in the Silverlight app that's using the data service, and somehow impersonate that user. The user is a Windows LiveID, which is what I have hard-coded in my connection string in my web.config. Thanks!  Web: http://invoc.net

User Impersonation

Hi everyone, I'm trying to impersonate a login to change security context without successful. Any comments will be appreciated. Here is the code:   USE master GO -- Create Logins. CREATE LOGIN [UsrTest] WITH PASSWORD = '123456789', CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF; CREATE LOGIN [UsrImp] WITH PASSWORD = '123456789', CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF; GO -- Create users. CREATE USER [UsrTest] FOR LOGIN [UsrTest]; CREATE USER [UsrImp] FOR LOGIN [UsrImp]; -- Create Procedure to change execution context. CREATE PROCEDURE dbo.usp_User_Impersonate WITH EXECUTE AS 'UsrImp' AS SELECT a.auth_scheme FROM sys.dm_exec_connections a JOIN sys.dm_exec_sessions b ON a.session_id = b.session_id AND a.session_id = @@SPID WHERE b.login_name = ORIGINAL_LOGIN(); GO -- Permmissions. GRANT VIEW SERVER STATE TO [UsrImp]; GRANT EXECUTE ON [dbo].[usp_User_Impersonate] TO [UsrImp]; GRANT EXECUTE ON [dbo].[usp_User_Impersonate] TO [UsrTest]; GO -- Logon with UsrImp. -- Run Query = OK (SQL) EXECUTE dbo.usp_User_Impersonate; -- Logon with UsrTest -- Run Query = No resultset :( EXECUTE dbo.usp_User_Impersonate; -- Even with sysadmin login = No resultset :( EXECUTE dbo.usp_User_Impersonate; --Clean up DROP PROCEDURE dbo.usp_User_Impersonate; DROP USER [UsrImp]; DROP USER [UsrTest]; DROP LOGIN [UsrImp]; DROP LOGIN [UsrTest]; Tested on: SQL Server

Page navigation in a frame throws an exception

I created a very simple WPF project that exhibits the following error. I have no idea how to get of this error. System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Menu', AncestorLevel='1''. BindingExpression:Path=TemplatedParent; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'CommandTarget' (type 'IInputElement') Steps to reproduce:1. Create a WPF Application project in Visual Studio 2008 (Windows 7)2. Create Page1.xaml <Page x:Class="WpfApplication1.Page1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page1"> <TextBlock> <Hyperlink NavigateUri="Page2.xaml">Page 2</Hyperlink> </TextBlock> </Page> 3. Create Page2.xaml <Page x:Class="WpfApplication1.Page2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page2"> <TextBlock> <Hyperlink NavigateUri="Page1.xaml">Page 1</Hyperlink> </TextBlock> </Page> 4. Add a frame in Window1.xaml <Window x:Class="WpfAppli

Impersonation issue | Multiple domain

Hi,I am working on an Intranet site.The site is running with the following configurationWindows 2003 Server, IIS 6The users of the site come from 3 different domains (say Domain A, B, C). We have Integrated Windows Authentication turned on. App pool identity - Network Service Impersonation is turned Off in web.config. We try to impersonate the original caller programatically for one functionality where we try to access contents of a folder on shared drive by giving a UNC path. System.Security.Principal.WindowsImpersonationContext impersonationContext;impersonationContext = ((System.Security.Principal.WindowsIdentity)Context.User.Identity).Impersonate();...DirectoryInfo rootDir = new DirectoryInfo(path); DirectoryInfo[] dirContents = rootDir.GetDirectories();// We show the folders and files which can be downloaded after this ..impersonationContext.Undo();  The web server and the file share are on domain AIssue The above functionality works fine for all users coming from Domain A but for users coming in from Domain B and C get System.UnauthorizedAccessException at rootDir.GetDirectories(). But when the same users type the same UNC path from Win>Run or File Explorer, they are able to open it.The users are all coming in through IE6, so they do not have to provide their user name, password as trust has been established between all 3 domains. Can anyone please p

ASP.NET Impersonation in IIS 6

Hey guys, I have a question. Hope you must have answer for it. I am using impersonation in my ASP.NET application to access network resources. It works fine when I run on my computer, however when I setup the site on IIS6, it does not work. Is there some extra configuration, I need make in IIS for it? Any ideas?Please also know following:1. I created an account "TestUser" with the privilege as "act as operating system" on a server that has the resources which I want to access.2. The impersonation works fine on my computer, when I run from visual studio. My computer is on the network under same domain where the "TestUser" is created.3. However, when I upload the application on IIS 6.0, which is on different server. It does not work.4. In the IIS, I disabled Anonymous Access and enabled Integrated Windows authentication. Application pool is default and application pool's identity is set as -> Predefined: networkThanks for your reply.raphikdanish/raphikdanish

Unable to evaluate expression because the code is optimized or a native frame is on top of the call

I have some code that gets the exception Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. I have pasted some code below. I have confirmed that I am in mixed mode debugging, (native and managed). I have also confirmed that I am not 'pre-compiline' b4 debugging. the code is for a 'csv' download. Can someone help? Response.Clear(); Response.ClearHeaders(); //set the conttent type of the file to be downloaded (IF NEEDED) Response.ContentType = "application/vnd.ms-excel"; // initialize the http content-disposition header to indicate a file attachment with the filename Response.AppendHeader("Content-Disposition", "Attachment; Filename=\"" + strFileNameCSV + "\""); //// transfer the file byte-by-byte to the response object FileInfo fileToDownload = new FileInfo(strFileNameCSV); Response.Flush(); Response.WriteFile(fileToDownload.FullName); Response.End();

How to databind Frame UriSource from two sources???

I need to create a navigation model where I can load content from listbox menu into frame and at the same time by clicking a usercontrol or a button in the loaded into frame page. I can successfully navigate by clicking menu items. However, I cannot do the same when I initiate page load into frame from already loaded page into frame. I am looking for the right technique to be able to achieve it. Here is what I did so far: I databind UriSource link from xml which is associated with items in the list box this way: Below is the XAML code: <Frame x:Name="ContentFrame" JournalOwnership="OwnsJournal" NavigationUIVisibility="Hidden" HorizontalAlignment="Left" Width="Auto" DataContext="{Binding SelectedItem, ElementName=Nav_ListBox, Mode=OneWay}" Source="{Binding XPath=UriSource}" /> <ListBox x:Name="Nav_ListBox" Margin="0,18,0,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#FFF2F2F2" ItemsSource="{Binding Source={StaticResource PagesData}, XPath=page}" /> I created a UserControl to be a container of the loaded data. Then, I generate repetitive content of the loaded page defined in xml. I also define UriSource associated with each item in xml I load into the page. Each item has unique UriSource. <Grid.DataContext> 

i make a web site using frame . A.Text box is in parent window . but i want when frame is load(fram

i make a web site using frame . A.Text box is in  parent window . but i want when frame is load(frame window Coding ) then parent window text is changed l(1)suppose parent window Text. is a when child widow is load thenparent window Text. is b

i make a web site using frame but session is expire Error message is my Config file is attache

i make a web site using frame  but session is expire message is Object reference not set to an instance of an object Description: HTTP 500. Error processing request. Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 at System.Web.UI.Control.LoadRecursive () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessLoad () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 My Web Config file is<configuration>    <!-- store the database connection info here -->     <appSettings>        <add key="sBook_StoreDBConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Program Files\CodeCharge\Examples\BookStore\BookStore_MSAccess.mdb;Persist Security Info=False" />            </appSettings>  <system.web>  <httpRuntime executionTimeout=&quo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend