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


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

Question about user used to execute code from app_code

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net
 

 Hello. I would like to know something about code execution  in App_Code folder.

Under wich user executed code from app_code.

I'm using impersonate in web.config




View Complete Post


More Related Resource Links

A Challenging Question for Advanced user....

  

Using  dot net How will you release .exe applicattion for 1000 clients.this question was asked by manager but i could not answer him.tell me if you can!!!


Automatically Execute Code at certain time from website

  

Is there a way to trigger a piece of code to execute at a certain time once a week?

I basically want my website to send out a reminder email every sunday. I have a function called SendReminder() and I would like to know if it is posible for it to run by itself because at the minute I have to press a button to run it.

Thanks


dynamically change html code when user is authenticated

  

So I have a fairly simple web site which allows an Administrator to edit some data in a database which is displayed on some web pages.


The main navigation on the site is shown in the code snippet below. The Admin link goes to a Login.aspx which allows the Administrator to log in - once authenticated they get sent to the data edit page.

So my question is, how could I dynamically add a link to the data edit page in the <ul> list below once the user is authenticated ?

This would allow the authenticated user to see links to the secure pages in the main navigation bar.


<%--Top Navigation Menu --%>
<div id="topMenu">
<ul>
<li><a href="default.aspx">Home</a></li>
<li><a href="introduction.aspx">Introduction</a></li>
<li><a href="curriculum.aspx">Curriculum</a></li>
<li><a href="times.aspx">Times & Fees</a></li>
<li><a href="staff.aspx">Staff</a></li>
<li><a href="login.aspx">Admin</a></li>
</ul>
</div><%--End of topMenu Container--%>
<div id="clear"></div><%--Floats items cleared End of Master Page--%>


output cache to be used only when parameter has changed + old question of user control not answered

  

hello,

i have 2 questions about output cache:

1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.

2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?

3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :

http://forums.asp.net/t/1588671.aspx

and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.

can anyone please help me?


How to make "UserId" equal to the "logged-in user" in vb code behind

  


I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator). Thanks very much.

 

Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

        If Request.QueryString("UserId") IsNot Nothing Then
            ' Get the connection string from Web.config.

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
                ' Create a command object.
          

ThreadStateException was handled by user code

  
Hi, I am using VB.net and I am getting this error only in debugging mode. Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process. The application works fine in release mode. Why? Please help.   Thanks

How it's possible to execute this code in C # WPF

  
Hi I have this code but I do not know how to do him in WPF   IF EXISTS (SELECT * FROM YourTable WHERE Key = 123)    PRINT 'EXISTS' ELSE    PRINT 'Dont EXISTS'   There is My Code in c#         private void button2_Click_1(object sender, RoutedEventArgs e)           {             DataSet ds6 = new DataSet();             SqlConnection con6 = new SqlConnection("Data Source=PC;Initial Catalog=Veo;Integrated Security=True");             SqlCommand cmd = new SqlCommand("Select * from [MHGROUP].CUSTOM3", con6);             SqlDataAdapter sqlDa6 = new SqlDataAdapter();             sqlDa6.SelectCommand = cmd;             sqlDa6.Fill(ds6);             string mySelectedValue = comboBox2.Text;             int newid;             newid = Convert.ToInt32(mySelectedValue);  

WebFaultException throwing a "not handled by user code" error and returning an HTTP 500 to the clien

  
I am trying to return a BadRequest and simple message when implentation throws an error in a WCF REST service, but the WebFaultExcption itself is throwing an exception and returning an HTTP 500 instead. Any ideas on why this might be happening? Here is a short code snippet: [WebDispatchFormatter] [WebHelp(Comment="Initiate an immediate or callback appoinment request")] [WebInvoke(UriTemplate = "InitiateContact", Method = Verbs.Post)] public string InitiateContact(AppointmentRqst rqst) {      string ret = string.Empty;      rqst.DeviceId = Helper.GetHttpAuthHdrDeviceId();      try      {          ret = impl.InitiateContact(rqst);      }      catch (Exception ex)      {          throw new WebFaultException<string>(ex.Message, HttpStatusCode.BadRequest);      }      return ret; }

Access a user created class in the form code

  
Hi Dear i have a litle problem i am developing a database application. In this app i write made two projects in the same solution. 1st named BussinessData and the 2nd one has a name Database Application. in business data i have add a libary class and made its region for easily code writing. now i want to get access at that class code from the application form code. example: sum of two numbers pubic class Sum #region "Public variables" dim a,b,c as integer #end region ' seperate region for getting values #region "Properites" public property a() as integer Get  return _a Set (by val value as sender)         _a=value end property #end region 'region for sum #region "Methods" public function sum() as integer c=a+b return c end function #end region in this way i have written the code and i want to get access this class from the form code. 'button_click code for the sum sum() plz help me to solve this problem  

how i can access a user created class in form code

  
Hi Dear i have a litle problem i am developing a database application. In this app i write made two projects in the same solution. 1st named BussinessData and the 2nd one has a name Database Application. in business data i have add a libary class and made its region for easily code writing. now i want to get access at that class code from the application form code. example: sum of two numbers pubic class Sum #region "Public variables" dim a,b,c as integer #end region ' seperate region for getting values #region "Properites" public property a() as integer Get  return _a Set (by val value as sender)         _a=value end property #end region 'region for sum #region "Methods" public function sum() as integer c=a+b return c end function #end region in this way i have written the code and i want to get access this class from the form code. 'button_click code for the sum sum() plz help me to solve this problem

Dynamically adding User Controls -- newbie question!

  
I am new to ASP.NET (coming from ColdFusion, thank goodness I'm away from that!).  And I am have THE hardest time understanding how to work with forms in ASP.NET.  Here's what I am doing:Dynamically add User Controls to a PlaceHolder based on some int value (which currently is passed in a HiddenField).Fire an event if the WebControls inside of the User Control change, then handle that event in the Main Page (i.e. save the input to DB)When the user clicks the "Next/Continue" button, the next controls for the next page are loaded.And I guess maybe I just can't seem to get how things work in ASP.NET, because I am really struggling with the general idea of how ASP.NET flows.  Should I be dynamically loading the controls in Page_Init, or Page_Load?  Or should I load the controls when the buttonclick event is fired?Do I have to add the axCtrl.OnDataChange += new EventHandler(HandleAxControlDataChange); line on Page_Load?  Or should I put this in When I first load the UserControl, I need to initialize some WebControls within the UserContorl.  Is there a way to know if I have loaded new user controls into my placeholder?  I can't use Page.IsPostback, because after the first page, every page is a postback from the buttonclick.Any help for this confused newbie would be GREATLY appreciated!!Here's what I have: pu

Why can't use 'user.identity.name' in masterpage code behind?

  
 I tried to use user.identity.name in a master page code behing  but intellisense doesn't recognize it.   If I change Inherits masterpage to inherit page then intellisense accepts it. What's going On?

execute a javascript function in code page

  
I use js function in source page and call that js function as below in Source page<a href="javascript:;" onclick="openwin('Sample.aspx?DID=<%#Eval("UID") %>', '', '700','300','yes'); return false ">I need to call this function from vb.net code page.....how to solve this ........???????????Give ur ideas...............

System.Data.SqlClient.SqlException was unhandled by user code

  
System.Data.SqlClient.SqlException was unhandled by user code  Message=Incorrect syntax near '01'.Unclosed quotation mark after the character string ' from month_day where month_name=datename(month,dateadd(month,01,0)-1)'.  Source=.Net SqlClient Data Provider  ErrorCode=-2146232060   LineNumber=1  Number=102  Procedure=""  Server=W2003-VM1-MK  State=1  StackTrace:       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()       at System.Data.SqlClient.SqlDataReader.get_MetaData()       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)   &nbs

Error For Execute User Define Function in remote host.

  
Hi there.I wanna to call a user defined function in stored proc.it's ok in local test but in the host it rises error: Cannot find either column "dbo" or the user-defined function or aggregate "dbo.MinCount", or the name is ambiguous.What should i do?

Question with this code

  
Hello all I have a question with this code, I'm still learning and I'm not sure what can be the possible error with this code Thanks in advance for the help! The error showed is this ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Index and count must refer to a location within the string. Parameter name: count Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: Index and count must refer to a location within the string. Parameter name: count Source Error: Line 54: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Line 55: Line 56: Usuario = Context.User.Identity.Name.Remove(0, 6).ToString Line 57: Line 58: Dim myConnection As New Data.SqlClient.SqlConnection ----------------------------------------------------------------------------------------------------------- This is my code ------------------------------------------------------------------------------------------------------------ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Usuario= Context.User.Identity.Name

Embedded code block question

  
Hello,i know it's a very basic problem but i can't use an asp.net code block the way i want.I have used those before but it seems i encountered a case i haven't seen before.<asp:SqlDataSource ID="SqlDataSourcetblCategoriesPourListe" runat="server" ConnectionString="<%$ ConnectionStrings:BottinConnectionString %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT label from mytable WHERE (HOrder = @HOrder)))"> <SelectParameters> <asp:QueryStringParameter DefaultValue="<% (int)GetDefaultValue()%>" Name="HOrder" QueryStringField="HOrder" /> </SelectParameters> </asp:SqlDataSource>Whenever i run this, i get an exception:Syntax error converting the nvarchar value '<% (int)GetDefaultValue()%>' to a column of data type int.How can i avoid this ?I am not doing it in the code behind because i use nested gridviews and sqldatasources.  Can't access nested sqldatasources from code behind, as far as i know.
Categories: 
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