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

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT
Post New Web Links

'variable' is not declared. It may be inaccessible due to its protection level.

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
I have been trying to get a value from my sql database to post to the form I have.  I have thought i was pretty close but it keeps giving me the error "User_EmailTextBox is not declared.  It may be inaccessible due to its protection level".  I have been trying to get this to work for a week and I can't seem to figure it out.  Any help would be appreciated.  My code is below.web.config ---------------------------------------------------------------------------- <?xml version="1.0"?> <configuration> <connectionStrings> <add name="ECDRConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ECDR.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="false" targetFramework="4.0" /> </system.web> <!--Mail settings--> <system.net> <mailSettings> <smtp> <network host="YOUR HOST HERE"/> </smtp> </mailSettings> </system.net> <!--Mail settings--> </configuration> --------------

View Complete Post

More Related Resource Links

is not declared. It may be inaccessible due to its protection level.



I try to create a new webb site using VS 2010 and .Net Framework 4.0, I wanted it to be a copy of an exsisting .Net Framework 3.5 based site, so I copied the aspx page code and the codebehind code from the old version when I created the new one, but now I get these errors...

is not declared. It may be inaccessible due to its protection level.

It seem I get this error on every control I have on the page, why is that and how do I fix it?

'' is not declared. It may be inaccessible due to its protection level



I hope I am posting to the correct forum. I see lots of reports of similar errors, but no fix for me. I have a new VS2010 website project. I am unable to call public routines in a public class in AppCode.

To debug, I built a new blank website project with a public class Class1 in AppCode and a public function Foo returning a string "Hello World".

A sub CallFoo calls Foo without error if CallFoo is in Class1. If  CallFoo is moved to a new class Class2 I get the above error.

I have rebuilt this test site from scratch targeting Framework 3.5 and 4 with the same error. Oddly, I have found I am able to reference public constants without error.

Any suggestions appreciated.


'__o' is not declared. It may be inaccessible due to its protection level.



I have 10-15 errors of this kind

'__o' is not declared. It may be inaccessible due to its protection level.

at my <%: start tags

Im new to this, so why do i get this error and how do i fix it.
I have looked at the numbers 0 that its not the letter oO, and the other way bag
And its ok...


            <td colspan="3" align="right">Netto:</td>
            <td align="right">
            <%: (Model.Cart.ComputeTotalValue() * 0.8D).ToString("c")%>
            <td colspan="3" align="right">Moms 25%:</td>
            <td align="right">
            <%: (Model.Cart.ComputeTotalValue() * 0.2D).ToString("c")%>

'Microsoft.SharePoint.MailMessage' is inaccessible due to its protection level

down vote favorite 'Microsoft.SharePoint.MailMessage' is inaccessible due to its protection level On this code: MailMessage mail = new MailMessage(); mail.From = "myemail@xxxxx.edu"; mail.To = "myemail@xxxx.edu"; mail.Subject = "Testing Code"; mail.BodyText = what; mail.Priority = MailPriority.High; Smtp.Send(mail, "smtp.xxxxx.edu"); How can remidy this? changes to web.config? Any way to circumvent in code? Thanks.

Linkheader inaccessible due to protection level


I am sure there is an easy answer to this but i am very new,

Child Page: code behind file

protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        SiteMaster master = (SiteMaster)this.Master;
        master.LinkHeader.NavigateURL = "~/Default.aspx";

Master: Code Behind

protected void Page_Load(object sender, EventArgs e)

    public string NavigateUrl
            LinkHeader.NavigateUrl = value;

SSIS Package Protection Level Errors - decrypt protected XML node "DTS:Password" with error 0x800900

Error 7 Error loading GetData.dtsx: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.   c:\Packages\GetData.dtsx 1 1  Error 8 Validation error. Data Flow Task: OLEDB Source [5310]: The AcquireConnection method call to the connection manager "SourceServer" failed with error code 0xC0202009. GetData.dtsx 0 0 Environment I need to execute - BIDSHave Solution, with files linked with VSS. When I click on package, aforesaid errors show up and package opens in designed.Protection Level : Encrypt Sesitive with User KeyThis means it'd run only on machine and by user where and who created respectively.So I changed it to Encrypt Sesitive with Passoword and provided Passoword. No luckSo I changed it to Do not save sensitive, as anyways in the connection manager, it has Expression saying @Variablename (with appropriate correct syntax), and variable is mapped to config file. I tired with Config file and also by hardcoding the value in the connection manager's connection string after removing the variable name, also tried by hardcoding value in variable value and disabling config file.Nothing works. I read 3 threads discussing this issue by othe

how to store the values in a object variable (package level scope) in a script component

I have declared a variable of object type with package level scope.  I want to assign values to this variable inside a script component.  My object should hold 5 columns in a row.  How to implement this ?

Cannot create MDX calculation with one variable in the calculation from a leaf level


I am new to MDX/SSAS and have a problem with setting up two calculations. I have spent several days researching, endless rewriting of MDX queries, and did not find an answer (or didn’t recognize the post as an answer to my problem :)


I need help with two calculations.

One, a calculation, let’s call it  [Dollar Variance], that computes variance at all levels by this formula:

([Actual Work Billings] - [Budgeted Work Billings]) / [Work Days in Month] = [Dollar Variance]


The problem is that while the [Actual Work Billings] and the [Budgeted Work Billings] are summed at the particular dimension intersects chosen, for the variance to be calculated properly, the

How to get the Package level Variable collections (Global Variable) in Script Task


Hi All,

I have the requirement like read all the Variables in Script Component Task, which includes variables available at package level and their values, global variables declared at package.


Currently are two ways to read the variables but which are not suitable for my requirement


1) Mentioning the variables at Script designer window as ReadOnlyVariables or ReadWriteVariables



Msg 137, Level 15, State 2, Procedure AddCMEXperience, Line 49 Must declare the scalar variable "@Re


Hi folks, can someone please help me with this error?

Msg 102, Level 15, State 1, Procedure AddCMEXperience, Line 15
Incorrect syntax near ','.

Msg 137, Level 15, State 2, Procedure AddCMEXperience, Line 49
Must declare the scalar variable "@ReasonLeft".

Here is the Stored Procedure that is in question here

USE [ResponsedDatabase]
/****** Object:  StoredProcedure [dbo].[AddNewEmployer]    Script Date: 10/03/2010 14:24:51 ******/

CREATE PROCEDURE [dbo].[AddCMEXperience]
    @MemberID bigint,
    @EmployerID bigint,
    @DateStarted smalldatetime,
    @IsContinuing bit,
    @DateLeft smalldatetime,
    @PositionStarted nvarchar(50),
    @PositionLeft nvarchar(50),
    @StartingSalary nvarchar(20),
    @EndingSalary nvarchar(20),
    @TimeWorked float,
    @JobResponsibilities text,
    @ReasonLeft, nvarchar(200)


INSERT CMExperience

Cant see package level variable in script component

I am currently having a issue accessing a package level variable.

My package level variable is called RecordSet1 and type object.

I was able to use a Data Flow and populate the variable with data with a record set destination.

So, now I am writing a script component that makes a recordset as a source(I am new to ssis and I know this has performance issues, I am only doing this to get familiar with scripting cause my manager told me too) So I am not able to access any of the variables. My code is below. I am getting a error on this.Variables.RecordSet1. I looked all over online and unable to really find a solution. I know in script component, you can use the this.Variables.VariableName to access the variables but even my intellisense isn't showing anything.

Error 1 'Variables' does not contain a definition for 'RecordSet1' and no extension method 'RecordSet1' accepting a first argument of type 'Variables' could be found (are you missing a using directive or an assembly reference?) C:\Users\Dhinesh\AppData\Local\Temp\SSIS\ee6fc0aaa4f447e0b024451e97f51dec\main.cs 42 39 sc_95443d5e406b44d

A Low Level Look at ASP.NET Architecture

ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET HTTP pipeline to process requests.

Local variable scoping in C#

In my previous post, Compiler-generated scopes for local variable declarations, I briefly touched on the issue of multiple meanings applied to the same name. In this post, I'll aim to flush out the compiler's rules with regards to binding names in their local scopes.

Compiler-generated scopes for local variable declarations

I was tasked with understanding and fixing a bug on error reporting with foreach iteration variables the other day, and it got me thinking about local variable scoping rules in C# in general. First, the bug.

Retrieving a variable from a previous page



I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


Embeb a variable number of videos


I need to provide some alternate content for my non-Flash users.

I have a directory of video files that is scanned using the DirectoryInfo() function, and I want to use the results to embed all files ending in ".mov" in QuickTime players on a web form.

How would you approach this? Right now I am using the count on the array of videos to determine how many times to repeat the embed code.  But this seems inelegant.

Is there a way to have a single QuickTime player.ascx control that gets duplicated according to the number of videos available for display?

How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

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