C# Storing Alternate Text In Session Variable Or Retrieving From Db?
Mar 2, 2010
I'm building a web system and various clients will have alternate text for default instances throughout the site. One place is the main nav but there are others. The default may be "project" but they may want to call it "event".I'm heading down the road of calling all the terminology settings (there's a list of about 15) and creating an ArrayList that has the id and either the default or their replacement as the items in the ArrayList.I've also got a enum key list called TermKey that has the defaults and the corresponding ID number.
Throughout the code I'll reference TermKey.Project and then do one of these things that I see as options.
1-pull the text from the session (if the client has set it to "event" then the text "event" will be waiting for the call there)2-pull the text from the database every time I need it.3-pull the client's list each time a page loads.Some thoughts on the impact each way or if there is a best practice for
View 5 Replies
Similar Messages:
Dec 28, 2010
I need to retrieve Username from the login page in my ASP.NET application so that it is available in other pages also. I am using VS2008. Is there any other of getting the value other than storing them in session.
View 4 Replies
Aug 30, 2010
When a use is logged in (Through open-id) we are creating a session variable named "UID" and storing the unique user-id in it. Later we are checking the session to see if the user is logged in. I think this is not the right way, but I could not force the team to change this, as I cannot show how this implementation can be cracked. why (If yes) this implementation is bad?
View 3 Replies
Dec 17, 2010
I am creating a website that allows users to login to their gameserver remotely and send / receive commands. The connection happens via an UDP socket and requires simply the IP of the gameserver, and a password.
On my website, users can add servers to their accounts, where the server IP and password are stored in a database. Then they can connect to any of their servers, which creates a new Socket object and connects to it using the IP and password of that server.
This Socket object, embedded in an object that also stores the server IP and password, is stored in a Session variable when the user connects, and is retrieved on every page. For example, there's a page where the user can view a list of the players on the server (and kick/ban them), a page with server settings, a page with messages, etc. All these pages require the Socket connection to get their information (they send a certain command and parse the response). When I need to send a command via the socket, I need to send the password of the server each time (otherwise it does not work). My question now is: how secure is this? The password of a server is sensitive information*, but I am storing it in a session variable and sending it (using the Send command of the Socket object) to the server.
i think the Session variable is stored on memory on the server, so I don't think so, but I'm really unsure about these kind of things and I'd like to be certain that my website is secure. Well, I think it will never be 100% secure but I want it to be at least not worth the effort for someone to hack the password. If it takes a lot of trouble then people wouldn't bother, but I don't want to find out that people's passwords are being thrown out on the street (so to speak) and that my website is completely insecure...
View 6 Replies
Mar 16, 2010
Im storing the user details in a session variable(session["userid"]) while login.
[Code]....
Im using the session variables in other forms ,there im checking the session variable using the following code.
[Code]....
In this form im having 'export to excel ' button.When i click this button session variable becomes empty and redirected to the login page.(Im having this problem in IE only but in FF it works fine).
View 2 Replies
Oct 28, 2010
I am storing Datatable in Session variable in my project. Is it good practise to do so? The datatable has 20 fields and can run into 1000+ records. Will it hamper my application performance?
View 11 Replies
Feb 24, 2010
Consider my dataTable contains 10,000 rows and i want to know the pitfall of storing datatable in a session variable... I want to use it until a new row has been added...What type of session mode should i use?
View 4 Replies
Mar 16, 2010
I'm having problems with retrieving multiple instances of a session variable from an InProc session state. In the following code I persist a simple BusinessObject into a session variable on the Page_Load event. On the click of a button I try to retrieve the object back into 2 new declared instances of the same BusinessObject. All works great until I change one of the properties in the first instance, it changes the second instance as well. Is this normal behaviour? I would have thought as these were new instances they wouldn't demonstrate static behaviour?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
' create a new instance of a business object and set a containg variable
Dim BO As New BusinessObject
BO.SomeVariable = "test"
' persist to inproc session
Session("BO") = BO
End If
End Sub
Protected Sub btnRetrieveSessionVariable_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRetrieveSessionVariable.Click
' retrieve the session variable to a new instance of BusinessObject
Dim BO1 As New BusinessObject
If Not Session("BO") Is Nothing Then BO1 = Session("BO")
' retrieve the session variable to a new instance of BusinessObject...............................
View 2 Replies
Feb 4, 2010
What is wrong with this code:
[Code]....
I am getting error message:
C:ProjectsMattBookQuestExport.aspx(123): Build (web): Literal expressions like '<%$ ConnectionStrings:BookList %>' are not allowed. Use <asp:Literal runat="server" Text="<%$ ConnectionStrings:BookList%>" /> instead.
C:ProjectsMattBookQuestExport.aspx(124): Build (web): Literal expressions like '<%$ ConnectionStrings:BookList.ProviderName %>' are not allowed. Use <asp:Literal runat="server" Text="<%$ ConnectionStrings:BookList.ProviderName%>" /> instead.
C:ProjectsMattBookQuestExport.aspx(125): Build (web): Literal expressions like '<%$ Session["SelectCommand"] %>' are not allowed. Use <asp:Literal runat="server" Text="<%$ Session["SelectCommand"]%>" /> instead.
Without SelectCommand I can compile.
View 7 Replies
Oct 27, 2010
I have heard alot about sql injection and how it is normally caused. Mostly sql injection in my opinion is caused through search boxes. Now my question is quite simple. Is it advisable to store the search keyword in a session variable to prevent sql injection? I don't want to expose the keyword through the querystring as it is prone to attacks. So in short there is no harm in using session variables to store the keyword right?
View 6 Replies
Oct 18, 2010
I have a gridview and a checkbox. I am able to pass the checkbox id to a textbox in the same page. This is then passed as a session variable. However, when I place an option to page and select the checkbox items in the next page, the session variable resets.Please see below code, how do I store "all checkbox" throughout all paging and store it in the session page?
[Code]....
Behind code VB:
[Code]....
[Code]....
[Code]....
View 4 Replies
May 23, 2010
I have what I think is a weird issue. I send text from one page to another via Session Variable. When page 2 loads, the text box has the session text set, but if the user changes the text and clicks the button, the SQL database is update with the original session text. If I remove the redirect from the page 2 button_Click method, then, the page refreshes with the textbox reverting to the session text and thr SQLDataSource has the session text added to it.
[Code]....
View 3 Replies
Sep 9, 2010
<asp:RadioButtonList ID="rblSplitWeek" runat="server">
<asp:ListItem selected="true">No Choice</asp:ListItem>
<asp:ListItem Text = "First" Value = "Session('s_price_1')"></asp:ListItem>
<asp:ListItem Text = "Second"></asp:ListItem>
</asp:RadioButtonList>
But keep getting an error when trying to put the session variable in
View 1 Replies
Oct 19, 2010
I want to change the text of a linkbutton by referring to it through a session variable.
For example how could a normal Linkbutton1.text = "buffoon" be referred to by a session variable if the Session("LinkButton") = "LinkButton1" ?
I am envisioning something like: LinkbuttonByName(Session("Linkbutton").text = "bufoon" .... but don't know how
View 6 Replies
Jan 15, 2010
I am designing an prototyping an app the needs to store images, similar to facebook. This will be a public facing site and I am not sure how many users I will end up with but what I am looking for is a way to efficiently retrieve them.
So far I am thinking of storing them in SQL Server varbinary columns. I have the upload code and the storage code for that. My concern is retrieving them. I can retireve and build the image tag on the fly but I am worried about having to hit the database for each one.
I have been thinking about getting all images for a user and caching them in the asp.net cache for 10 to 30 seconds. I have never had to do something like this so I would be interested in hearing a few different approaches. Obviously the images can vary in size and I was thinking about defining a size limit, but I haven't gotten that far yet.
View 3 Replies
Jan 28, 2011
i am a beginer and i want to know how to store images in the database tables like pictures of the pizzas and when the user selects one of the pizza from the dropdownlist he sees the image of the selected pizza.
View 2 Replies
Mar 29, 2011
I have a web application developed in .net 2.0 I am storing large business objects in session, which change frequently.
Some times I observe server error. Is this causing the error?
Is there any alternative way to store these objects?
View 3 Replies
Feb 8, 2011
I've a problem with asp:image and asp:imagebutton alternate text: it's not visible when I move the mouse over the image. I declared the object in that way:
<asp:ImageButton ID="ButtonStatus"
ImageUrl='<%# IIF(Eval("Active")=1,"../images/folders/actived.png","../images/folders/deactivate.png")%>' CommandName="ChangeStatus" CommandArgument='<%# Eval("id_repository") %>' OnCommand="FolderCommand"
Enabled = '<% #iif(mySecurity.Admin=1, "True", "False") %>' Width="24px" AlternateText="Change the status"
runat="server" />
and for asp:image
<asp:HyperLink runat="server" ID="url_groups" NavigateUrl="~/action/Group_manager.aspx?action=2">
<asp:Image id="img_groups" runat="server" ImageUrl="~/Images/folders/group_config.png" AlternateText="Group manager"
EnableViewState="false" ImageAlign="Middle" Width="32px" CssClass="navigation" />
</asp:HyperLink>
View 2 Replies
Nov 22, 2010
Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.
View 11 Replies
Aug 10, 2010
I've got a table where i'm storing a CheckBox.Checked value.
I'm using C# and the value of the field in the table im writing to is a bit.
myDS.InsertParameters["p1"].DefaultValue = CheckBox1.Checked.ToString();
The value placed in my table ends up being either "True" or "False".
So when I try to query the table based on that value with a stored procedure it doesn't work since its looking for a 1 or a 0.
I think the .ToString() is part of the problem but i don't know the syntax to have the value from the CheckBox.Checked to be written as 1s or 0s instead of true or false.
View 1 Replies
Apr 14, 2010
I am having two aspx pages(Page1.aspx,Page2.aspx).I am stioring values in Session in Page1.aspx and retriving the same values from Page2.aspx.But if the session value is null I am getting an error as 'Object reference not set to an instance of an object.'Here is my code..
[Code]....
View 5 Replies
Jan 8, 2010
I am working on document management system. finding guide / code for Storing and Retrieving doc/pdf/xls files in SQL Server 2005.
View 1 Replies
Feb 18, 2010
I am storing image (jpeg) files into SQL server 2005 using MS Access Forms. When I try to read and render it on a webpage using ASP.net and C# code behind, it could not read it.
But if I write the image to SQL server using ASP.NET C# and then read it back using ASP.NET C#, it render the image just fine in the browser.
Does anyone know if Access write the blob is difference than ASP.NET write the blob into SQL server? I am using the same varbinary as my column in the database.
View 3 Replies
Aug 27, 2010
I'm using a lot of LinkButtons in my web application with text and images inside them. All LinkButtons are set with a ToolTip and all images inside the LinkButtons are set with an alternate text.
<asp:LinkButton CssClass="button button-input" ID="btnSearch" runat="server" CausesValidation="False" ToolTip="Search">
<img id="imgSearch" runat="server" src="../../../images/icons/magnifier-left.png" alt="search-something" width="12" height="12" />
</asp:LinkButton>
The problem is that in Internet Explorer the alternate text of the image is shown instead of the ToolTip of the LinkButton. In Firefox this problem doesn't exists, it always show the ToolTip of the LinkButton.
This is the produced XHTML:
<a href="javascript:__doPostBack('...','')" title="Search" id="..."><img width="12" height="12" alt="search-something" id="..." src="../../images/icons/magnifier-left.png"></a>
Is it possible to overcome this issue? Removing all alternate texts will resolve the issue but a better (more standard) way is always welcome!
View 1 Replies
Aug 13, 2010
I have a LoginName1, LoginView and Login Status on my Master Page. Whenever a user logs himself in, the LoginName1 displays (as for example):
Welcome omarakhtar
Now the only thing I want is how to store this omarakhtar into some variable? Kindly, let me know.
View 1 Replies