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


Post New Web Links

Redirect Unauthorized Users

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net
 

I've decorated a Controller action with:

[Authroize(Roles="Admin")]

When a user who's not in that role attempts to invoke that action, they get redirected to the Login page even though they're already logged in.  How do I redirect an unauthorized user to a different page to inform them that they do not have the proper access level?




View Complete Post


More Related Resource Links

Hide documents from being access by unauthorized users.

  

Hi experts,

I would like to know how to hide certain documents (eg. Word, Excel, PPT, PDF) in a document libraries from unauthorized users? I tried implement Target Audience, but it doesn't work. If anyone know, i really appreciate for the guidance.

p/s: If my posting is not relevnt to the thread, please kindly move it to the appropriate places. Thanks!


How to stop unauthorized users from sending documents to a Records Center site?

  

I can't find a way to stop unauthorized users from sending documents to a Records Center site. Can someone please help me? Do i need to configure anything to restrict it to the members of the web submitters group?

I'm still using MOSS2007

Thanks!


The impossibility of doing things depends on your will to do it.

deny unauthorized users with an alert message

  

 Hello i am using Asp.net ,vb. I want to deny users who have not logged in with a message" you have to login to access this page".
Can someone help me write the code in vb.net?
Thanks in advance


MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Enabling Users to Maintain SharePoint Content

  
When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Some areas of the site usually contain less-dynamic information. Internal memos and corporate policies are common examples of this information. One option for this information is to post these documents in a document library. Documents in a library are often stored in a few different formats: Word, Acrobat (PDF), or HTML. Each of these formats has its drawbacks.

Enabling Users to Maintain SharePoint Content

  
When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Response.Redirect slow

  

I'm in the middle of migrating servers and on the new server Response.Redirect is extremely slow. It takes around 20 seconds for the browser to get the redirect. This is something that was quick on the existing server. It's an ASP.NET 2.0 application, both servers are running IIS6.

Additionally, if I "manually" do the redirect, it's fast. For example:

Existing way:


Response.Redirect(url);

takes around 20 seconds on the new server


New way:

Response.Status = "302 Moved Temporarily";
Response.AddHeader("Location", url);
Response.End();

is fast on the new server.


Any ideas why Response.Redirect would be so slow on the new server?


Need help redirecting users to personalized page

  

 Hi, first timer here so be gentle.

 

I've been able to create a cool little website, it's up and running with users logging in and out, I created roles so my administrative team can see sensitive data that's not available to regular and anonymous users.

Now they would like me to create a page specific to each user.  For instance when user A logs in they are redirected to a page that has information that pertains to user A only (like a list of their benefits/ their remaining vacation time). This page needs to be accessible only to user A. 

I've watched a ton of the videos but have yet to see one that covers this topic, any help would be great!!!

 

Thanks

 

 


Intranet Users Challenged When Using Windows Integrated Security

  

We've setup an intranet site using Windows Integrated Security. Its up and running and users can access it. However, they are being challenged with a login dialog for the server when they initially access the site.

Isn't is possible to configure the server so that the users aren't challenged AND are recognized as being already authenticated by Windows? We're trying to go with a seamless experience, whereby all they have to do is login to their machine like normal and then go from there.


Automatically redirect to HTTPS and check if SSL is active

  

Hello,

I've set in the web.config:

    <!-- User Authentication -->
    <authentication mode="Forms">
      <forms loginUrl="~/Page/View/Content/Login.aspx" timeout="2880" requireSSL="true" />
    </authentication>


This works fine. If there is no ssl connection, the login form doesn't continue. But I would like to check if ssl is active (in codebehind) and, if it's possible, to automatically the user to the https page if he's currently on http. (I could do this job by manually redirect with page.response("https://url.../login.aspx"); but this is not really generic. For example if the webapp is moved to another domain it doesn't work anymore... I'm looking for something like: FormsAuthentication.RedirectWithSSL(); or so... :D)

Regards,
Chris 



Profile not being save after redirect.

  

Hello,

I am trying to save values into a Profile on Page1, then redirect to Page2 and access those values.  However, after the page redirects the profile values are blank as if they were never saved.   When stepping through the code I can see that they are being save on Page 1.

I suppose I could use session variables to store the information but I don't understand why saving the profile doesn't work.

//Page1
private void PayWithPayPal()
    {
        ProfileCommon profile = this.Profile;

        if (Global.CurrentUserName.Length > 0)
            profile = this.Profile.GetProfile(Global.CurrentUserName);
        
        profile.FirstName = uxFirstNameShipping.Text;
        profile.LastName = uxLastNameBilling.Text;
        profile.ShippingAddress.AddressLineOne = uxAddressLineOneShipping.Text;
        profile.ShippingAddress.AddressLineTwo = uxAddressLineTwoShipping.Text;
        profile.ShippingAddress.City = uxCityShipping.Text;
        profile.ShippingAddress.State = uxStateShipping.Text;
        profile.ShippingAddress.ZipCode = uxPostalCodeShipping.Text;

        profile.Save();
        
        Response.Redirect("~/expresspayment.aspx", false);
    }

//Page2
protected void Page_Load(object sender, EventArgs e)
    {
        
        ProfileCommon p

Users getting logged out because HttpContext.Current is null

  

We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

Getting users list reporting to manager from LDAP

  

Dear All,

I need to get list of users reporting to a particular manager from the Active directory.

In the active directory there is manager property with contains the data in the following way.

CN=Gegore Lid,OU=IT,OU=Sales,OU=XXXXX,OU=XXXX,DC=YYYY,DC=intra


Please help me in building the filter condition.


I am using the following

pUserName="Gegore Lid";

strSearch = "(&(objectClass=user)(objectCategory=user)((Manager cn=" + pUserName + "))";

DirectorySearcher dSearcher = new DirectorySearcher(dEntry, strSearch);

            //Account properites to load
            string[] arrPropertiesToLoad = { "displayName", "department", "manager", "sAMAccountName", "EmployeeNumber", "Title" };
            dSearcher.PropertiesToLoad.AddRange(arrPropertiesToLoad);

          SearchResultCollection sResultColl = dSearcher.FindAll();

 the above code is not returning any result.


Please help me in this.


Regards

Prakash



Use Membership but bypass / disable password usage for users

  

I have an application that does LDAP authentication. The authentication is done on the code behind page of my Login.aspx page. Once the user passes LDAP authentication, a cookie is set and I redirect:

FormsAuthentication.RedirectFromLoginPage(UserName.Text, False)

I would like to setup membership in my application and keep track of some user information. But due to company security requirements, I cannot store user passwords on my application. That must stay on the LDAP server only.

Is there a way to store users but disable password storage on the aspnet_membership table?


Categories: 
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