.net - Redirect On Authorization Failure
Mar 6, 2011
I have several sections
<location path="Page1.aspx">
<system.web>
<authorization>
<allow roles="superadmin"/>
[Code]....
I want to make a redirect to the specified page if authorization failed. And this is not general page. I want to make a specific redirect based the page user wants to open. How it can be done?
View 3 Replies
Similar Messages:
Apr 9, 2010
Here's my scenario.
I've got a site called domain.com and also another product on product.domain.com. The product.domain.com requires authentication to access it. For consistancy in the user experience I have set the login url in the web.config on product.domain.com to be http://domain.com/Login.aspx. This redirection is working ok - and a sample url would be:
http://domain.com/Login.aspx?RedirectURL=/default.aspx
The problem is that the RedirectURL does not take into account that the request originally came from product.domain.com so when the authentication is successful the user is not redirected back to product.domain.com
I have come up with a solution for this but would like feedback if possible.
I changed the loginURL in the web.config to http://domain.com/Login.aspx?domain=product.domain.com so the sample url is now:
http://domain.com/Login.aspx?domain=product.domain.com&ReturnURL=Default.aspx
I then override the LoggedIn event in the membership control and check to see if the domain value pair is specified and if it is I redirect to the domain + ReturnURL.
As I said previously i'd appreciate any comments or other ways to achieve the same result.
View 1 Replies
May 12, 2010
Currently, when the authorization fails, it redirects to the login page by default. However if the user is logged in, it makes no sense to be redirected to the login page. I would like it to be redirected to an eror page instead.
View 5 Replies
Mar 29, 2011
I am using ASP.NET MVC 3 and am trying to do something that should be really straight forward...
My application uses Forms authentication and that is working perfectly for controllers/actions. For example if I decorate either a controller or an action with the attribute below only members of the administrators group can view them:
[Authorize(Roles="Administrators")]
However I have a folder under the default Scripts folder called Admin. I only want members of the Administrators group to be able to access scripts within this directory so I created a new web.config in the directory with the following inside:
[code]....
However no matter whether a user is a member of the Administrators group or not they receive a 302 Found message and are then redirected to the login page.
If I change the web.config to allow user="*" then it works. It also works if I add an allow users="Username" for a specific user I am testing with.
View 1 Replies
Jun 28, 2010
When a user attempts to directly visit the url admin.aspx, and they are not an admin, they are redirected to the login page. However, the user then attempts to visit ViewWeek.aspx, it indicates that they are still logged in. Why does this ASP.NET authorization boot the user to the login screen, yet keep the user logged in? I'd rather it just direct the user to the default URL specified in the forms tag.
Here's my Forms Authentication:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" defaultUrl="ViewWeek.aspx" timeout="50000000" />
</authentication>
View 1 Replies
Apr 26, 2010
Our team has recently implemented a role permission based authorization so that we can have granular control. This is similar to what Rockford Lhotka suggests herehttp://www.lhotka.net/weblog/PermissionbasedAuthorizationVsRolebasedAuthorization.aspx I have also read about the Claims based authorization which to me looks very similar to what we have. Can some one put in simple terms what the advantages of claims based authorization are.
View 1 Replies
Feb 17, 2010
In Visual Studio 2005.I have created a Blank solutions(XYZ) and then add a ASP.Net Web Service Project(TESTP) under it.And then create a .asmx file(WEBFI.asmx) and then write a method and add [WEB Method] on top of the method.Now compile it.And then publish it.But in publishing folder I didn’t found any WSDL file which I should call in different machine (which is in LAN ).
View 6 Replies
Dec 20, 2010
I'm trying to deploy my MVC 2 web project on IIS 5.1, because that's all I have for now to work with. I installed Visual Studio 2010 on the server and can run the web app successfully. When I try to access it via the browser, I get the following error:
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I'm not sure what's going on here. I don't get this error when running the app through Visual Studio. It seems probable that ASP.NET is using a network identity when I access it through a browser, but I'm not incredibly savy at server configurations. The MVC app is set up to get the currently logged in user's credentials from its own database, based on the NTLogin of the person accessing it. I can get this to work, but again only in Visual Studio.
View 12 Replies
May 16, 2010
have embedded a TreeView inside an Update Panel, PopulateOnDemand in use.When a top level node is expanded everything is fine - the level 1 (zero base) nodes are populated.When on of these lower level nodes is expanded the tree Collapse
View 2 Replies
Mar 11, 2010
i am trying to create a strong name for assembly.....by giving the below code----
assembly:
AssemblyDelaySign(false)]
assembly:
AssemblyKeyFile(@"UsersABCDocumentsVisual Studio 2008ProjectscodeaccesssecuritycodeaccesssecurityinDebugABC.snk")]
assembly:
AssemblyKeyName("")]
when i am compiling project i am getting this error........
Error 1 Cryptographic failure while signing assembly 'C:UsersABCDocumentsVisual Studio 2008ProjectscodeaccesssecuritycodeaccesssecurityobjReleasecodeaccesssecurity.exe' -- 'Error reading key file 'UsersABCDocumentsVisual Studio 2008ProjectscodeaccesssecuritycodeaccesssecurityinDebugABC.snk'
-- The system cannot find the path specified. '
View 1 Replies
Jan 11, 2011
I have a web form for a user to update their user information. I have an ObjectDataSource configured to use the Update method in my BLL. If the user changes their email address in the web form, the BLL Update code checks to make sure the email address is not already in use. If it is in use, I want to cancel the update and notify the user.I was going to raise an ApplicationException in the BLL and catch it in the web form code-behind, then present a message to the user. But from what I read, this is bad practice: http://blogs.msdn.com/b/kcwalina/archive/2005/03/16/396787.aspx
View 9 Replies
Jan 4, 2011
I'd just gotten the MVC application I'm working on to connect to the database when the machine it was on went down. Now, for development purposes, I've installed the database on my local SQL Server 2005 Express installation. I jumped through all the hoops for getting the connection set up. I have:
Opened the Surface Area Configuration and set it to allow Local and remote connections. In the same area, I set the SQL Server Browser to Automatic startup and started it. In SQL Server Mgmt Studio Express, under Security/Logins, I added a user with a Server Role of 'sysadmin' and in User Mapping for the specific database in question I checked 'db_owner'. I also restarted the services and then rebooted the machine when restarting the services didn't work. But it's still giving me the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Here's the weird part. I can open SQL Server Mgmt Studio Express and log in with the user I created as described above. Login is successful, and I have complete access to the database. In Server Explorer, I've set up a connection to this exact same database without any problems. I can connect to it and list the tables, get their data, etc., no problem. I can also use the "osql" command to connect to and retrieve data from the same database.
It seems safe to say that the database is definitely there and can be connected to. So, I thought there must be something wrong with my connection string. Since the Server Explorer is connecting to and displaying data from the database, I copied its connection string, which looks a lot like this:
Data Source=myServerSQLEXPRESS;Initial Catalog=myDatabase;Persist Security Info=True;User ID=SwinglineUser;Password=***********
Of course, the Password has been replaced with the actual password (just in case someone thought I might have forgotten that step). So, absolutely everything I try connects to the database without the slightest issue, except for my MVC application. I'm not sure what else to try. Could there be some difference in how to set things up if you're connecting to a local server?
View 6 Replies
Jun 28, 2010
Here's the situation. I have an aspx page that is designed to receive a POST request with some XML values, parse the XML, grab the relevant items, and write them to the page. The problem arises when I try to launch the page using the POST request. When I launch using Fiddler, building the request manually and just pasting the XML in the body of the request everything works fine and dandy. When I launch the page from a basic HTML form, however, things don't go so great. The HTML form that I'm using looks like this:
[Code]....
When the page loads I get the error:
A potentially dangerous Request.Form value was detected from the client Everything I've read so far has told me that the solution is to add ValidateRequest="false" to the page directive in the top of the .aspx file, or in the pages element of the web.config file. But neither of these work. Afterwards, I still get the same error. Any idea what I need to do to make this work?
View 5 Replies
Aug 31, 2010
I have used gmail for sending mail localy which worked fine but when i uploaded the same file on server the "Failure sending mail." error occured. here is the code i have written:
Dim message As New MailMessage
message.From = New MailAddress("[URL]
message.To.Add(New MailAddress("[URL]))
message.Subject = test mail""
message.Body = "Hi you have got a test mail from me!
Dim client As New SmtpClient
client.Credentials = New System.Net.NetworkCredential("[URL]"xxxxxxx")
client.Port = 587
client.Host = "[URL]
client.EnableSsl = True
client.Send(message)
View 2 Replies
May 8, 2010
I have implemented a send mail functionality. For that i installed the SMTP Service on my local machine by going to 'add remove programs' -> windows components -> iis (properties) -> checked the smtp service option and installed. Below is my code that i am using in my application to setup the smtpclient object and sendmail()
[Code]....
Now i don't know why i am getting 'Failure sending mail' error. Definitely i am missing something. what i am missing and how can this be fixed. This is frustrating me now as i dont know much in this area.
View 1 Replies
Feb 3, 2011
I am currently familiarizing myself to WebMatrix. I am interested in creating a webpage. I have installed all necessary programs. I have also created a webpage but when I try to run the program I get the following message:
URL Binding Failure Cannot start the website because admin privileges are required to bind to the hostname or port.
Recommendations: I thought I might do it manually. I went to the Site Panel, on the Main Page I then tried to select 'ASP.NET Web Pages Administration'. Clicking this and anything below it cause WebMatrix to crash. It also causes it to crash if I select run and not run with IE8 (no webpage is displayed even though i have a aspx page).
View 2 Replies
Jan 11, 2010
I am developing an ASP.NET application that prints multiple images.I have a gridview with some data that I use to query the database for the image path.If the image is in one table, the document is sent to the printer, if not, I search another table for the document.When a run the application on my devel machine everything works fine, but when it runs from the production machine and it needs to search the image from the second table
View 2 Replies
Apr 29, 2010
I've got an asp.net application which I've deployed to my shared hosting provider. I've modified the connection string to point to the MySQL database stored on the shared server, and the page loads correctly.
However, when I run the page through the internet (as opposed to through VWD2008), I get an error:
Unable to connect to any of the specified MySQL hosts.
I'm not sure where I've gone wrong. The MySql.Data.dll; MySql.Data.Entity.dll and MySql.Web.dll are all in the /Bin folder.
View 3 Replies
Jan 14, 2010
I've been scratching my head for what seems like ages. I'm sure its really simple to fix but I can't see it.
I have a class in App_Code that uses a bit of Linq.
var siteMap = SiteMapWrapper.BuildSiteMap(true);
var currentTopLevelParent = siteMap.Single(s => s.IsActive);
if (currentTopLevelParent != null)
I've developed this locally and all works fine. When I transfer to IIS hosting the same class fails to compile. I receive:
does not contain a definition for 'Single' and no extension method 'Single' accepting a first argument of type 'SiteMapWrapper' could be found (are you missing a using directive or an assembly reference?)
I confirmed that the virtual dir is running .NET 2.0 as it should. I also confirmed that the correct assemblies are being loaded in the web.config.
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
View 3 Replies
Jul 7, 2010
I'll start off by stating that I've read numerous posts with the same or similar errors but haven't found anything to solve my issue. I'm getting a lengthy error message:
Sys.Net.WebServiceFailedException. The server method'GetSlides' failed witht he following error: <html>
<head> <title>Unknown web method GetSlides<br> ....
I appreciate any insight. See inserted code.
[Code]....
[Code]....
[Code]....
View 1 Replies
Feb 28, 2011
How to set failure Text on login Panel when user is unapproved (didnt make activation yet...), locked
View 1 Replies
Mar 24, 2011
I have a javascript function that is called on tab change of a tab container.From that javascript function, I call a simple page method.But though the page method does everything correctly, a failure is reported.Here is my code:
[Code]...
View 9 Replies
Sep 23, 2011
I used code below to save XML document but got an error said that
Logon failure: unknown user name or bad password.
Dim src00 As New XmlDocument
src00.Save("orderReportsorder.xml")
What is wrong? I check orderReports, my account has full control.
View 2 Replies
Aug 12, 2010
I am using asp login control on my aspx page. and for different conditions, i need to show different failure messages. so , I am resetting FailureText property in code behind.
but, the control does not show failure message for any condition.
I have converted this login control to template for design purpose.
View 1 Replies
Mar 5, 2011
I am using FireFox v3.6.14 I am developing on VS2010 and have a project with a web and Silverlight solution.try to run the project I get the above error.I cant work out if its Visual studio error or a firefox error, Im pritty sure its not my code!!Ive tried running the same app via Chrome with a similer error.
View 1 Replies