C# - Use Of Static Objects In Page?

Feb 5, 2010

I am using the followign object in my asp.net page

private static Dictionary<string, List<Guid>> OpenNodes = new Dictionary<string, List<Guid>>();
//Page start
if(!OpenNodes.ContainsKey(Session.SessionID))

[code]...

View 3 Replies


Similar Messages:

Architecture :: Using Static Methods To Build User Objects And Various Other Objects?

Jun 21, 2010

firstly a static class only ever exists once and is not an instance. Any static members (ie static int NoOfPeople;) is stored in one place and is shared between all sessions (like the old global variables).
Now static methods is where i'm not 100% sure. If I have a static method that doesn't use any other static members could this cause inconstant results, example (this is a fairly pointless method but just a quick example of the top of my head)

[Code]....

So in this example if two sessions (or threads) were to call this at the same time - would they both get back the expected results, because the method only uses private data (a, b and totalToReturn).Im sure this sounds a little simple but I will be using static methods to build user objects and various other objects that there will have to be a 100% garentee that the objects will not get mixed up between sessions and the wrong things return to the user.

View 5 Replies

DataSource Controls :: Static Variables Vs Linq2sql DataClassesDataContext Objects

May 6, 2010

im developing a silverlight project using silverlight 3, vs2008 and linq2sql. when projects starts, im storing all the data from database into some static list variables. so when ever i need data, im reading it from those static list variables. all i want to know is, is it good to store data in static list variables and use it when ever necessary or is it good to get data directly from DataClassesDataContext object like db.mytable. which is the rite and fastest way or retrieving data. i mean which will use less connections to database?

View 2 Replies

Forms Data Controls :: Binding A Repeater To A List Of Objects That Have Child Objects?

Nov 17, 2010

have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this

Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;

Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship

For instance <%# Eval("UserName") %>

But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)

<%# Eval("Role.RoleName") %>

View 2 Replies

Forms Data Controls :: Binding An Objects(containing Sub Objects) To A Dropdown List?

Apr 6, 2010

I know how to bind a simple objects to a dropdown list. However I am having problems binding my objects which contains sub objects to the control.i.e. with simple object i just do ddl.DataValueField = "myproperty"
with my objects they contains sub objects which i want to bind. I have tried ddl.DataValueField = "sub-object.myproperty" which doesnt work.

View 2 Replies

C# - Static Music Player That Remains On The Page Playing No Matter If The User Navigates Away To Another Page Within The Site?

Sep 15, 2010

I am needing to have a music player (something like a strip down at the bottom of the page that goes all the way across), that remains at the bottom even when the user navigates to another page within the same site.The purpose of this is to play music on the website no matter where the user goes on the website.

View 1 Replies

Javascript - How To Embed A Static HTML Page In Aspx Page

Mar 7, 2011

I have a static HTML page complete with client-side scripts and css (both are included in the html). I was wondering if it would be possible to embed this HTML page into an ASPX page and have the ASPX page be able to respond to javascript events that are raised from within the static html document? Does asp.net provide a specific control for this or can I use a frame?

View 3 Replies

C# - Is It Safe To Access .net Session Variables Through Static Properties Of A Static Object

May 10, 2010

Is it safe to access asp.net session variables through static properties of a static object?Here is what I mean:

public static class SessionHelper
{
public static int Age
{
get
{
[code]...

Is it possible that userA could access userB's session data this way?

View 2 Replies

C# - How To Lock A Private Static Field Of A Class In One Static Method

Mar 26, 2011

I have a private static field in my Controller class in an MVC web application.

I have a static method in that controller that assigns some value to that static field, I want to apply lock on that static field until some other instance method in the controller uses the value stored in the static field and then releases it.

DETAILS:

I have a controller named BaseController having a static ClientId field as follows and two methods as follows:-

public static string ClientId = "";
static void OnClientConnected(string clientId, ref Dictionary<string, object> list)
{
list.Add("a", "b");
// I want the ClientId to be locked here, so that it can not be accessed by other requests coming to the server and wait for ClientId to be released:-
BaseController.clientId = clientId;
}
public ActionResult Handler()
{
if (something)
{
// use the static ClientId here
}
// Release the ClientId here, so it can now be used by other web requests coming to the server.
return View();
}

View 1 Replies

AJAX :: Calling Non-static Methods From A Static Method?

Jun 30, 2010

I did some research after posting. All I found was simple examples for no-layer architectures, like connecting to a database from your aspx page, so, in a corporate environment, it is unnaceptable.

I need to call a server-side method (using ASP.NET Ajax) in a 3-layer architecture.

For example, my Default.aspx contains a method LoadProducts().

[Code]....

[Code]....

This cannot change. There is no way to convert Business and Data layers to static.

How can I call the LoadProducts() method using ASP.NET Ajax?

View 2 Replies

MVC :: Displaying Two Separate DB Objects On The Same Page?

Nov 2, 2010

What I would like to do using LINQ is display two seperate db objects on the same page using ASP.NET MVC. So I could have URLs like:

www.x.com/location1/item1

www.x.com/location1/item2

Displays the information for Location1 and items 1 or 2.

www.x.com/location2/item1

www.x.com/location2/item2

Displays the information for Location2 and items 1 or 2.

There is no difference between item1 and item2. So each location could be associated with each item.

View 1 Replies

C# - Access The Objects Of The Previous Page?

Dec 17, 2010

I've used PreviousPage Property to access the controls of the previous page but how can I access objects and instances of classes I initiated in the previous page!

View 2 Replies

C# - Where Does Static Variable Work In Page

Apr 26, 2010

I had an interview today and every thing was going very good, but then an interviewer asked me a question Where Does Static Variable Work in C#- At Application Level or At Page Level.I was not very much clear about this answer as I only knew that static variables are stored on heap and I didn't knew anything about web related thing.

Then he tried to make me more clear by giving an example that in a page I am using static variable and three users are accessing the page one of the user updates the value of static variable, What value will be visible to remaining two users an old copy or the update will be reflected.

View 3 Replies

Accessing Master Page Objects From Classes?

Mar 22, 2011

I have a single master page in my application. It has a Label control for displaying Error Messages. I want to be able to access this Label control from any child page or Class module within the application. How do I reference this label from a Class module. I simply wish to use a Try Catch construct in the Class Module and reference the MP Label in the Catch segment.

View 13 Replies

Security :: Wrapping Authorization Around Page Objects?

Jan 26, 2010

A few years ago I worked with a team that developed what we thought, at the time, was a unique security model for a company ecommerce site. We wrapped every object (that we cared about) with a authorization / role check. So internal and external would use the same site but what fields, buttons, links etc. that they saw varied with their authorization / role assignments. I know .NET now has some RAD (Rapid App Dev) tools for security / authentication / authorization. Everything I have been reading is based upon securing pages / folders / areas of a site but nothing about the level of granularity we took it to so:

1. Was this not such as good way to go back when we did it?

2. I thought Microsoft had an entire security "plug-in" (Not Windows Authentication). Database, roles, etc.

(Don't get me wrong they have made life a ton easier with what they have given us)

3. What is the current method / practice in use for reasonably high security ecommerce environments. Cookieless Forms Auth? Something new altogether?

View 2 Replies

Where The Static Variables Are Stored In Aspx Page

Apr 4, 2011

Possible Duplicate: Where are static variables stored in asp.net aspx page Hi can someone please tell me where the static variables are stored in asp.net aspx page.Is it in the view state? If so I guess you wouldn't want to stored big complex objects?

View 1 Replies

Saving A Static HTML Page On The Client?

Mar 21, 2011

saving a static HTML page on the client, so that I can then upload it back to the server? I'm building a Gantt style page, then allowing the user to "draw" on it using VML (This will change to SVG once we are off IE6). I need to be able to save the page (including the VML) to temp and then upload it back to the server as a static HTML file.

View 2 Replies

Rewrite Dynamic URL To Static Page Using RewriteMAP?

Jul 19, 2010

I have been struggling with this now for about two weeks, Within my site that functions as a directory, there are some simple Categories that appear to the user ashttp://www.mysite.com/subcat.aspx?catid=1 in the browser address bar. There are 15 of them in total.I would like to rewrite the URL of these Categories using RewriteMap in the following manner:

<rewriteMap name="CategoryNamesPrettyURL" defaultValue="">

View 4 Replies

C# - Pdf Render To Web Page Results In Static Title?

Nov 22, 2010

having a slight issue where i am rendering a pdf (stored as a byte array) into an asp.net web page, using the code below:

Response.ClearContent();
Response.AppendHeader("content-length", document.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(document);
Response.Flush();
Response.Close();

This works with no issues at all, however in order to render this pdf (ie. return the byte array) we are calling a web service by passing a few parameters in the QueryString. This is where the issue comes in. Once the PDF renders, it shows the title as the complete url + query string of the page. obviously, for security reasons we dont want users getting a hold of that information.does anyone know how to set the title of the page once the pdf renders out? i have tried making the header run server side, however it doesnt have any effect. interestingly, if the pdf render fails, or a data method fails before hand it changes the title correctly. its almost like once it hits the pdf rendering it changes the title back to the url/querystring.

in addition to this, i also checked the title of the PDF that was passed back by the web service and the title stored in the PDF properties is completely different to the title rendered on the title bar of the page.

View 1 Replies

Which Classes / Objects Store Details About The User Of A Page

Jan 28, 2010

which classes/objects store details about the user of a page: things like IP number etc.

View 2 Replies

Web Forms :: How To Manipulate UserControl Objects From Main Page

Aug 16, 2010

I have a Masterpage which contains two contentpalceholder, first one for a Usercontrol and second one for my web forms.

Now I want to change the usercontrol's property of sqldatasource from out side of usercontrol such as some web forms. Can I access objects of usercontrol from the other web forms or masterpage?

View 1 Replies

Web Forms :: Dropdownlist / Getting To Update Objects On The Page The User Is Currently On?

Dec 1, 2010

I'm working on a school project where my website idea of choice is one that creates mixtapes (well, you'd download them or burn them from the site, but I need not implement that). The site allows its users to create 6 song mixtapes that are then published into a transaction table.

That part I am fine with. Making the selection page is tough. The way I have it set up is that there are 6 columns with 3 drop downs. First the user picks the genre, then the artist WITHIN the genre, and the song from the artist (GENRE > ARTIST > SONG). So, I would need the ARTIST drop-down list to populate once a SelectIndexChanged occured on GENRE. Same with SONG, but it would use ARTIST instead of genre.

Repeat that 5 more times and click a button, and it would create a table and post it to the database.

I have thought up of 2 ways to go about it.

1) Create a session that expires once the user clicks the "create" button. This would be sluggish, as there would be about 12 page refreshes, and 12 session variables I'd need to store.

2) AJAX/jQuery. This way would be awesome, but I have no idea how in the world to write jQuery in such a manner that on an event it calls a method from a code-behind file.

One thing I found out before my brain went to mush (I've been working on this for 6 hours now), is that one way people have done this is to call a non-related .aspx file that serves as a method. The idea is ok, but how do I go about getting it to update objects on the page the user is currently on? I'd believe there is a simpler way to do this, and am looking to you guys for some guidance on how to dynamically update dropdownlists.

View 2 Replies

Public Static Variable Declared In Public Static Class MyGlobals In A 'Code File' Template?

Jan 27, 2011

I have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.

View 9 Replies

Access Static Class Properties From Aspx Page?

Jan 28, 2010

I am on .aspx page and i want to take the width and height of a control from a static class
where i have defined them as constans.

Is there any way to access that class directly from the aspx page?

I know that i can make a method like:

width="<%= getWidthSize() %>"

and inside the aspx.cs to define this method to take the size from that static class.

But i am asking if this could be directly managed from the web aspx page...?

View 2 Replies

Web Forms :: How To Access The Page Controls In Static Methods

Oct 4, 2010

How to access the page controls in Static methods.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved