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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Prevent direct access to page by typing URL

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

Hi.. I would like to prevent user to access the page by typing URL before login. I place the codes in login page load. but i can't run login page. Instead it runs the unauthorised page..


   if (Session["StaffID"] != null)





View Complete Post

More Related Resource Links

Prevent direct access to embedded page


Im using an aspx page as the srcl for an image in the host page to serve a dynamically generated image to the user based on parameters they supply


<img alt="" src="generateimage.aspx" id="imagegen"/></div>

Id like for people only to access the content via default.aspx and not the dynamically generated content generateimage.aspx. Any attempt to browse here directly should be redirected to an error page

Sorry if this is basic but any help would be gratefully appreciated

Disallow Direct Access To Files



Here is my dilema, on my site i have a WordPress Audio player (http://wpaudioplayer.com/standalone) that plays my mp3's.

It loads the Mp3's in by javascript...example below:

       AudioPlayer.embed("audioplayer_7", { soundFile: "/Files/Music/[name of file].mp3" });

This file name is clearly visible in the browser source. Not a problem, however this means that any user can legitimately browse to the file directly and download it.

Now i still need the mp3 player (which is flash) to have access to the file but if a user was to try accessing the file directly, they would not be allowed access to it.

I am not sure how to go about this, i am circling the idea of a httphandler but not sure if this is sufficiant to stop the direct access to the file.

Any help would be appreciated

Access Classes in an aspx page that is in folder in asp.net


I have classes in App_Code:
Connection.cs, ClientData.cs ....

I have a folder Authenticated within it have an aspx page Client.aspx

How do I access the page through Client.aspx ClientData.cs the class, because there is a mistake for me to define the class as I do, please help me!

"Only their own" allows users to edit, then shows access denied page

I am managing a WSS 3.0 portal.  I have created custom lists where a group has contribute permissions.  Under List Settings|Advanced Settings, when I set Edit Access to "Only their own" or "None", my test users can see the Edit Icon and the Edit Item menu option, and bring up the Edit Form.  When they click "OK", they get the Access Denied page.  My experience in that past is that they should not even been shown the option to edit, and they should get Access Denied if they somehow navigate to the EditForm.aspx page.  I even tested this on a brand new site, with three Links lists, each with different Edit Access Levels (All, None, Only their own).  I added one user with contribute permissions.  He had the same result: He could get all the way to EditForm.aspx, but got "Access Denied" when he submitted his changes.  What can I do to fix this?Christopher W. Douglas

master pages - how to access content page from master page?

Hello,I have a master page setup that is used throughout my site that is basically a header with a menu. I recently added a textbox and a button to this master page which is to be a quick search box that is available anywhere in the site. When a user enters text into the search box and hits the button, I need to load the actual content page which is used to search and show search results (which also uses this same master page), and have the text entered available so the search can be triggered automatically. Again, this search text box and button is now in my master page so it could be  triggered from anywhere in the app... it serves as a convenient way to do a basic search from anywhere in my app, without having to first navigate to the actual 'search page' that already exists.  You can also navigate to the actual search page, which uses the same master page, where there is many more search options.I'm thrown off by the master page arrangement, which I have not used until this project. What do I do?

How to Access Parent Page (.aspx) control (IDs) from its child User Control (.ascx)

I have a parent .aspx page that has a asp:panel control in it, and this parent .aspx is also referencing a user control that I registered in that .aspx. Lets just call it usercontrolA.ascx for this post.The user control has a radiobuttonlist itself.Based on a selection from the radiotbuttonlist in the user control, I want to be able to hide the asp:panel in my .aspx (parent) but unfortunately I cant' get it to work:parentPanel.visible = true;  <<< I trried this in usercontrolA.ascx.csBut the user control doesn't know about the panel in the parent .aspxSo do I need to expose that somehow from the parent so that I can access it from the code behind of the child .ascx?  How?

Anonymous Access to "Event Export" on sharepoint calendar display page

I am using a SharePoint calendar with events added in the list. When an anonymous user tries to use "Export Event" on the display page ,the user is prompted for a login. Is there a way that an anonymous user can download the .ics file without logging in ? Is anonymous access even possible ?    

Accordion control access in Javascript using Content page

Hi, I struggled with some javascript issues, and discovered that the problem seemes to come from a failed ajax control access.Here's my problem:I have a master page and a content page.In my content page, I have an accordion with 2 panes.1rst pane: a textbox and a validation button;                     I want the button to fire javascript function without reloading page (using "return false;");In my master page, I put my ToolkitScriptManager.In my content page, I put my script containing the functions.The problem is that it seems like I can't access the accordion control in my js functions, whereas I can access my textbox value...Here is my source:<%@ Page Language="C#" MasterPageFile="~/Default.master" Title="CLEOR RH | Home" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server"> <script type="text/javascript"> var step1 = false; function pageLoad() { var accCtrl = $find('AccordionCtrl_AccordionExtender');

Prevent Excel access to SQL 2000

I see many questions on how to access SQL from Excel. I'm trying to do the opposite. We have a few purchased applications that use SQL as the database engine. With the capabilities in Excel 2007 making it so easy to connect to the SQL server, we see this as a security issue. We don't want our users to be able to access the database tables through any other methods besides through the application interface (a thick client in one instance and a web-based app in another). How can this be prevented? We are using AD for authentication and authorization and SQL 2000. Our DBA doesn't think this can be prevented. I'm the secuity guy and I'm responsible for data integrity. Are application roles a possibility? I understand they're difficult to maintian. From what I understand, this would allow the application to submit credentials to SQL without relying on AD credentials for individual users. Can SSL be used to encrypt the communications on both the thick and IIS applications? Thanks in Advance

Lost access to Central Administration Page

After trying to troubleshoot why all the e-mail alerts stopped working, I ran the best practices analayzer and ran the commands it suggested the paragraph below. "The same account that you use to run SharePoint 3.0 Central Administration must be configured as the SharePoint Timer Service. If they are not the same, the system may not be able to send Alert Notifications and you will not be able to add a content database to a web application using the Manage Content Databases page. Although there are built in mechanisms to keep these accounts synchronized, it is possible to manually change the SharePoint Timer Service account. If the account that you are using to run SharePoint 3.0 Central Administration is the correct account, you can log on to the Web server where the SharePoint Timer Service running as the wrong account. From a command prompt change to the directory where the SharePoint Timer Service is running, this is typically C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN, and run the command: stsadm -o updatefarmcredentials -identitytype configurableid -userlogin domain\account -password password. Although you could directly update the SharePoint Time Server account by opening Administrative Tools, Component Services, you should use this approach only as a last resort. To avoid inconsistencies between the

In report manager is it possible to prevent users from going to the "Home" page?

I have created my own menu system and would like to prevent casual users from ever going to the home screen as it just confuses them.  Is there a way to turn off this option?

How to re-direct particular page after login


Can any one help me how to redirect to particular page after login. I have login,EDetails,home page..

1.If the user login very first time(suppose he does not have any personal details) he should be directed to EDetails.aspx

2.User who submitted the personal details already should be redirected home.aspx page.

I have 2 tables later i will add more,1.login table,2.employee detailed table.I am using Login control for login page
I am using Version ASP.Net3.5 with MySql database, Code where i am redirecting in login page

 Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
        If YourValidationFunction(Login1.UserName, Login1.Password) Then
            Login1.Visible = False
            Session("UserName") = Login1.UserName
            Response.Redirect("EDetails.aspx", True)
            e.Authenticated = False

access to page for various user


i have 3 difference user type in my project
in my project ,i want  to permit employee to access page that i define .
for example:
page1 emolpyee1 can view it
but page1 employee2 can not view it

I control my form with sql.i built table and check access.my roles are not limit.i think it is better that i create table with my name page,and userid and control users with this table.is it a good solution? 

how do I access my personal page?


Hi there,

I know I've seen it before but I can't find it anymore.

There's this "mySite" sharepoint site that is reserved to be used by the user to build their own personal page.

Can Anyone point me to where I can access it?

Access Denied on Page Creation


I'm getting a weird little thing on one of my sub-sites that I am looking to see if anyone has insight into.  I have a parent site collection (1) that has a child sub-site (2).  The child sub-site then has it's own sub-site (3).  On 3 I have users that have full control.  This is the only site they have full control on.  When they use the site actions drop down to go to create page.  They get access denied.  If they go to View All Site Content and click on create they do not get the access denied error.

What I found is that if I go to the parent site 1 that you can only create pages from site actions if you are a site collection administrator.  These users do not need to be site administrators on the parent site.

Does anyone know if there is a setitng somewhere that needs to be changed?  I can't find anything.

Access PreviousPage on the button click handler of target page


Hi, I Have two pages source.aspx and target.aspx. Source.aspx has one button and other form controls the collect input. The button has its postbackurl property set to target.aspx.

On target.aspx I have another button and other form controls that collect input. When the user clicks on the target.aspx button, I want the inputs from both source and target gathered to be inserted into the database. The problem is the Page.PreviousPage property is only available during the initial rendering of the target.aspx page. So when I click on target.aspx button, PreviousPage is now null. 

One strategy of mine is to collect the information on page_load and store it in ViewState, but is there any other method that I should consider in this process. I think the cleanest approach would be to somehow access PreviousPage on the button_click event handler, but how can I access this property.


Unable to access default.aspx page


When I was testing the use of some of the web parts available to some user's web page, I created a web part to list the content of some document librabry we have.

When I was editing the web part's <Actual View>, on the "Folders" category I chose the "Show this view" as "Folder of the content type", "Sent Letters" (example).

As soon as I pressed OK I was redirected to the home page of that content type list.

I tried to return to site's the Home Page by pressing the Home Page button and event typing the URL http://servername/default.aspx but I keep being redirected to the document list I chose for the web part.

This only happens to the user wich created the troublelling web part.

How can I reset the home page of that user?

Please help

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