Using Session State Don't Work Properly

Dec 8, 2010

i am still new to using session state, i want to convert page name into and integer according to a database table a function then compares "X" and "Y" to check if a user have the right to view this page i know this is not the best way of managing website security, but it is like "training on how to use the session" what have i done wrong

Partial Class advancedsearch
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Label1.Text = Session("username").ToString
Label3.Text = Session("role").ToString
Label4.Text = System.IO.Path.GetFileName(Request.Url.ToString())
Catch ex As Exception
Response.Redirect("login.aspx")
End Try
If Label1.Text = "" Then
Response.Redirect("login.aspx")
End If
Dim x As Integer = Int32.Parse(Label3.Text)
Dim y As Integer = Int32.Parse(DropDownList1.SelectedItem.ToString)
If x < y Then Response.Redirect("login.aspx")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("default.aspx")
End Sub
End Class

View 1 Replies


Similar Messages:

State Management :: Session Doesn't Work In IE

Jan 6, 2011

I would like to display a modal dialog using jQuery the first time a use browse my site. My fisrt idea is to check a variable in the session. So i do this:

[Code]....

In Google chrome and Firefox everything works fine but in IE it doesn't work.

Why this code doesn't work in IE?

What is the best way to display a model dialog the first time a user briwse a site in MVC2?

View 3 Replies

Get Uploadify To Work With Cookieless Session State?

Jan 18, 2010

I have an uploadify control working fine in a vb.net web application - however whenever I switch on cookieless session state in web.config (cookieless="true") - it stops working.

In my upload IHttpHandler I can see that the data stored by uploadify is nothing:

Private Function Process(ByVal context As HttpContext) As String
Dim File As HttpPostedFile
File = context.Request.Files("filedata") ' Nothing
Dim FileExt As String = context.Request("fileExt") ' Nothing, etc
...

View 1 Replies

State Management :: Sending Paramater Using Session But Its Doesn't Work?

Aug 9, 2010

I got the viewCustomer.aspx page sending parameter to EditBusiness.aspx page as per below coding .

After that i retrieved to EditBusiness.aspx.cs by using (Request.QueryString["customerId"] ) and save in session . Then i tried to use the session in the EditPersonal.aspx and EditOther.aspx is worked but then back to EditBusiness.aspx the customerId parameter is disappeared . I believe is because in EditBusiness.aspx.cs using string customerId = Request.QueryString["customerId"] . Even I have tried cookies but its doesnt work .

ViewCustomer.aspx.cs
protected void grdCustomer_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Mod")
{
Response.Redirect("EditBusiness.aspx?customerId=" + e.CommandArgument.ToString().Trim() + "&mod=Modify");
}
EditBusiness.aspx.cs
string customerId = Request.QueryString["customerId"]
Session["customerId"] = customerId.ToString();
EditPersonal.aspx.cs and EditOther.aspx.cs
string customerId = Session["customerId"].ToString();
qry = "select *from customer where customerId = " + customerId;

View 4 Replies

State Management :: Session Tracking - Adding Entry And Continue Work

May 29, 2010

I am developing a intranet site and want to track the users, I am using session for this purpose, I am using windows authentication mode so there is no login form here. When a user clicks the url for the first time a new session is created and at that time I am adding a entry in a table(say :Users) with username and logintime and sessionid etc. Below is the logic Iam using in form_load event of Default.aspx

If session("user") is nothing then
---create new session (at this point I am adding a entry in table(users))
Else --- use the same session and continue the work.
End if

When I check the users info in the table some entries are created with same userid and same sessionids with different login time, how this is possible. I just want to know who is logged in and what time.

View 2 Replies

Web Forms :: 3.5 Error: Unable To Make The Session State Request To The Session State Server?

Dec 7, 2010

Have not run the ASP.NET Development Server for a while. Today I copied a production website to my workstation and ran it with VS 2008. The following error message popped up. What is the problem with the ASP.NET development Server on my workstation? The website on the Production server still ran okay.Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection.
If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

View 2 Replies

State Management :: Error :Session State Has Created A Session Id, But Cannot Save It?

Nov 18, 2010

I read the solutioin for this error, at the following link :http://forums.asp.net/p/1046935/1576341.aspxbut I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?

View 4 Replies

What's Difference Between Normal Session State And Cookieless Session State

Feb 16, 2010

In ASP.NET, I'm a bit confused about role of cookies in session state. Whats is the difference between normal session state and cookieless session state?

View 5 Replies

.net - Can't Get FormsAuthentication To Properly Work With WCF?

Apr 15, 2010

I have both the wcf and asp.net project together in the same project. (I'm running on Azure, so this is more convenient).I have this set in the web.config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
y wcf service is decorated with:
[code]...

View 1 Replies

Calendar.SelectedDate Does Not Work Properly?

Jan 14, 2010

I'm using ASP.net 2.0. I want to set a calendar control's selected date to 30 day before today. My code is like this:

theCalendar.SelectedDate = DateTime.Now.Today.AddDays(-30);

but It does not work.

View 1 Replies

JQuery :: Mouseenter Seems Not To Work Properly

Feb 14, 2011

I have such markup:

div id="wrapper"
nested table
text here
here
and here
the same thing here
here
and here

View 2 Replies

Does The SessionState Attribute In MVC 3 Work Properly

Feb 11, 2011

I'm managing a rather large project, written in asp.net webforms + mvc3, with a large user base, and a pretty high daily visitor count. Basically, there are a lot of requests at any given moment.

One of my controllers in MVC that handles / resizes images on the fly has the following attribute applied to it:

[SessionState(SessionStateBehavior.Disabled)]

Now, if an action in the controller tries to access the session - it obviously throws an exception - so we're good so far. The problem is: if I go to the IIS Worker Processes window (Win Server 2008 R2, IIS 7.5), and check the current requests for this site, I can sometimes see the requests to an action in this controller. Their current state is locked in State: RequestAcquireState, Module Name: Session. Sometimes these locks go over a second or two in this state.

Wasn't the whole point of the attribute in the first place to make the requests to the controller ignore the state, and not waste time (and possibly being locked) trying to acquire the state? If this is so - am I doing something wrong here, or does the problem lie elsewhere?

View 1 Replies

Click Event Not Work Properly?

Nov 3, 2010

In my website I wrote that code:

protected void Page_Load(object sender, EventArgs e){ LinkButton lbtnTopicAddress = new LinkButton(); lbtnTopicAddress.Click += lbtnSpecificTopic1_Click;}
protected void lbtnSpecificTopic1_Click(object sender, EventArgs e){ Server.Transfer("~/SpecificTopic.aspx)"
}

But when I press on the link in run time, the caller doesn't go to the EventHandler method.Why?

Note,

I wrote code like that in many pages in the same website but it work only in one page.

View 2 Replies

Web Forms :: Sort Datatable Does Not Work Properly?

Mar 15, 2010

now i use the dataview to sort the seq of datatable and bind to repeater, it can only display the seq correctly.but i found that it is not the actual database seq, when i remove the row from the datatable, it is not remove the record that i see from the UI.do i need to sort the seq to the actual datatable not the dataview.now i use the seq (int) in datatable to sort the datatable as belows:

DataView view = dt.DefaultView;
view.Sort = "SEQ";
repeater.datasource=view;
repeater.databind();

View 4 Replies

Web Forms :: Like Statement Doesn't Work Properly

Sep 17, 2010

I wrote a statement such that

cmd ="select [title] from products where sku='% "3.5 caddy" %'"

this statement wont return anyfin where there is products with titles startin with 3.5 or ending with caddy or containing 3.5 caddy but just not together for example there is this title "3.5" IDE to USB 2.0 Aluminum External Silver HDD Enclosure Caddy" and that search of 3.5 caddy wont pick this item up as 3.5 is at the start and caddy is at the end.

View 1 Replies

AJAX :: AutoComplete Doesn't Work Properly

Jun 11, 2010

I'm new here and I need some help to use the AutoComplete Extender. I just have a default.aspx with a textbox extended with an AutoComplete. My Web Service calls a SQL Data Base thru Linq and return some account names.When I execute the WEB SERVICE and manually insert the parameters, it works! But when I execute the default.aspx, nothing happens. I really apreciate your help! See the CODES listed below:

See the Web Service code below:

[Code]....

Now, the code on DEFAULT.ASPX

[Code]....

I tried put the files in a remote SERVER, and I got the following error (in LOCALHOST I don't see that error):

Configuration Error
Server Error in '/PC' Application.
Configuration Error

Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

Source Error:

[Code]....

Line 8: <configuration>
Line 9: <system.web>
Line 10: <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
Line 11: </system.web>
Line 12:
Source File: e:homeuysoftWebweb.config Line: 10
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.4028

View 7 Replies

Access :: Statement Doesn't Work Properly

May 8, 2010

I have written a bunch of T-sql code to my accessdatasource selectcommand. But I am having problem with where statement ! here is my code;

SELECT OWGBP, RTGBP, OWEUR, RTEUR, OWYTL, RTYTL, (SELECT Resort FROM Resort RF WHERE (View = True) AND (RF.ResID = TypePrices.ResID)) As ResortÄ°smi, (SELECT Destination + ' - ' + CodeOfDest FROM Destination TD WHERE (View = True) AND (TD.DestID = @DestID))
As DestIsmi, (SELECT TypeOFTrf FROM TRFTypes WHERE (TRFTypes.TRFTypeID = TypePrices.TypeOfTRF)) As TrasferTürü, @QADT As ADTSayi, @QCHD As CHDSayi, ([CHDPerCent]/100) As PerCHDCent, (ADTSayi ++ CHDSayi) As Deger, ResID FROM TypePrices WHERE ([View] = True)
And (ResID = @QRes) AND (Deger >= [MinReq]) AND (Deger <= [MaxCap])

And here is my select parameters;

[Code]....

It is a bit long ! I am having problem on last two where declaration. here ;

(Deger >= [MinReq]) AND (Deger <= [MaxCap])

those MinReq and MaxCap columns are int32 columns. But when I run the page it doesnt work properly ! It display the valuse it shouldn't be ! weird thing is, when I display this 'deger', I get the value properly. with this;

DeÄŸer : <b><asp:Label ID="Label10" runat="server" Text='<%# Eval("Deger")%>'/></b>

for example I get 8 with this but it dosnt work on where statement.

View 13 Replies

Dropdown Menus That Use Jquery Don't Work Properly

Aug 27, 2010

I designed a simple site with some css and jquery. All the css is in the header using and the javascript files are in a folder called Scripts and referenced in my site like below. Everything is beautiful locally, but on the server some objects such as a couple of my divs are out of their original positions, and my dropdown menus that use jquery don't work properly but they do work somewhat (like they slide down or fade). I have made identical folder structure in root on the web server. I am using .NET 3.5 and the server does support it.

Do you guys think it can be a path issue for my scripts? What could cause the css to move divs out of position? Does css or jquery behave differently on different servers?

<script src="Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.validate.min-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="Scripts/jquery.validate-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.easing.1.2.js" type="text/javascript"></script>
<script src="Scripts/jquery.color.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>

View 5 Replies

Web Forms :: Upload Control Wont Work Properly

Mar 2, 2010

why my upload control will not work properly when placed inside an ajax tab control? If I place it outside the tab control everything works great.Here is what I'm trying.

[Code]....

[Code]....

View 1 Replies

Does Basic Date Picker Work Properly In IIS Server

Feb 14, 2011

I used Basic Date Picker when i deployed the site and run on the IIS server then it is take the wrong date.I need the date formate as "dd/MM/yyyy" therefor i made changes in region setting but it can't work properly

View 1 Replies

Response.Write() With JavaScript Doesn't Work Properly

Mar 24, 2011

I'm having a problem with this code:

[code]....

The thing is that, the first if statement works fine and the 'javascript' shows an alert and close the window, but in the second if statement the javascript shows the message but doesn't close the window.

View 2 Replies

Security :: Can't Get Localhost Self Signed Certificate To Work Properly

Mar 1, 2011

I created a self-signed certificate for testing in IIS7 (win 7 64 bit environment ). I attached the cert to the bindings, etc and everything was fine. But when I crank up the site I get the generic error: There is a problem with this website's security certificate. Continue to this website (not recommended). What should I be looking at to fix this

View 5 Replies

C# - Cache-Control HTTP Header Does Work Properly?

Mar 22, 2011

I am having issue with cache-control. I have one IIS website with multiple host headers. When you browse site number 1 then cache will be set for this site, when you open browser again and go to 2nd site you will see content from first site. How can I determine cache content based on the site user visits? Everything working fine when you have 1 site and host header related to SAME site.

//Set Cacheability
if (!Context.User.Identity.IsAuthenticated && _activeNode.CacheDuration > 0)
{
var eTag = GetETag(_activeNode);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);

[Code]....

View 1 Replies

State Management :: Application State And Session State?

Oct 2, 2010

User Interface: 2 Labels; 1 Buttons

Requirements: Create a Web Page in ASPx that will do the following:

1)One label will provide a count of how many times Button 1 has been clicked in the current session.

2)One label will provide a count of how many times Button 1 has been clicked by all users of the application. The Application Code for the Button should start at 100 (set this in the Global.asax file). this is what i have so far but i cant seem to get the application state to work properly.

aspx.vb

Partial Class _Default
Inherits System.Web.UI.Page
Dim clickcount As Integer

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Session("ClickCount") Is Nothing Then
clickcount = 0
Else
clickcount = CInt(Session("ClickCount"))
End If
If Not IsPostBack Then
If Request.Cookies("UserName") IsNot Nothing Then
Label1.Text = "Welcome Back " & Request.Cookies("UserName").Value & "."
End If
End If
Dim clickCounta As Integer = CInt(Application("ClickCount"))
End Sub
Protected Sub PostBackSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.Click
clickcount += 1
lblClkCnt.Text = "Current Click Count is " & clickcount
Application.Lock()
Dim clickCounta As Integer = CInt(Application("ClickCount"))
clickCounta += 1
Application("ClickCount") = clickCounta
Application.UnLock()
AppClick.Text = clickCounta
Dim nameCookie As New HttpCookie("UserName", _
TextBox1.Text)
nameCookie.Expires = Now.AddYears(1)
Response.Cookies.Add(nameCookie)
End Sub
Protected Sub PostBackSession_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.PreRender
Session("ClickCount") = clickcount
Application("ClickCount") = clickcount
End Sub
End Class
global.asax
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(Application("ClickCount"))
Application.Add("ClickCount", 0)
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(HttpContext.Current.Application("ClickCount"))
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub

View 3 Replies

Web Forms :: Delete Directory And 2 Files That Are Inside Does Not Work Properly

Mar 13, 2010

I have a ListBox1 on the Form that I read in the same Directories: "GetS" as in the code below.

Now I select the first index wich is 0 in the listBox with the mouse and press Button1.

What the code below does is to find that specific folder that also contains a .BMP file and a file: File1.txt

So I will first delete the .bmp file and the File1.txt and at last the directory.

My problem is as follows. When I press Button1 the First time, nothing at all was deleted but the second time I press the Button1, the .BMP file and the File1.txt were delete fine.

But the code breaks at this line and says that the directory isn´t empty. But the directory is empty as I can see when open it manually.

So initially my problem is why the .BMP, File1.txt and the directory aren´t deleted at the first press of Button1 ? (ListBox1 has AutoPostBack set to TRUE and everything is put inside an updatepanel)

[Code]....

View 7 Replies







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