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


Post New Web Links

Authentication only for one page

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net
 

Hi everyone,

The error:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.


what I'm doing:

I need to enable forms authentication for only one of my pages.

so I made an application under my project using IIS and enabled its forms Authentication. The application contains the page that requires user to log in and a web.config. Below is the code of web.config under the application. 

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      
      <authentication mode="Forms">
        <forms loginUrl="login.aspx" protection="All" timeout="60" />
      </authentication>

      <machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />

      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
</configuration>


I can't move these codes to the main web.c


View Complete Post


More Related Resource Links

Crystal Report Asking for Database Authentication each time when I view Page.

  

Whenever I open my Crystal Report page, I am taken to the Database Authentication page where I am asked for

User name
Data Name
Password

each time.

Is there a way to avoid this and I save these authentication in my page once.

I am using VS2005, C#.

Any Help will be appriciated.

Thanks
Asif


HttpWebRequest Form Authentication Not Getting Past Login Page

  
Hey Guys,I am trying to use HTTPWebRequest to login to a site and then retrieve the page after login. However, it seems as if I can't get past the login. I also investigated with Fiddler and tried mimicking Fiddler almost completely and still no luck.Any idea what I am doing wrong?Thanks,Mohammed    Dim webRequest As HttpWebRequest Dim responseReader As StreamReader Dim responseData As String Dim postData As String = "login=testexpert@yahoo.com&password=testexpert" Dim cookies As CookieContainer = New CookieContainer() Dim requestWriter As StreamWriter Try 'post form data to page strUrl = "https://www.ideeli.com/login" webRequest = HttpWebRequest.Create(strUrl) webRequest.Method = WebRequestMethods.Http.Post webRequest.ContentType = "application/x-www-form-urlencoded" webRequest.CookieContainer = cookies webRequest.ContentLength = postData.Length requestWriter = New StreamWriter(webRequest.GetRequestStream) requestWriter.Write(postData) requestWriter.Close() 'recieve cookie webRequest.GetResponse().Close() 'now we send the cookie webRequest = HttpWebRequest.Create("http://www.ideeli.com") webRequest.CookieContainer = cookies responseReader = New StreamReader(webRequest.GetResponse.GetResponseStream()) responseData = responseReader.ReadToEnd() res

Authentication required, redirect to login page

  
Hi,I want authentication required for all webpages in a site. If i copy the url of any of the web page in the current site and paste it in the url address i should redirect to login page. If you have any solution please suggest it.

Form based authentication Sharepoint 2007 gets redirected to login page

  
Hi We have sharepoint 2007 site deployed on Windows server 2008, IIS 7.0.  We extended the web application to enable forms based authentication referring to link http://msdn.microsoft.com/en-us/library/bb975136(office.12).aspx#MOSS2007FBAPart1_Intro, we selected Kerberos instead of NTLM, behavior is like, when user tries to login into the site using OOB login.aspx, user again gets redirected to the login page. We tried to extend the web application again but this time we selected NTLM, but this time farm account (also is application pool identity) is not able login and exhibits same behavior as above, but for other users we are able to login. Has anyone come across this behavior? can anyone please guide me in correct the behavior? Regards, RK  Radhakrishna

Forms Authentication sending user to LoginURL on first hit of page even though page has [allow users

  
On the first hit, and only the first hit, to my page having [ALLOW users="*"] in the web.config, the user is redirected to the LoginUrl, but on all subsequent visits to the page, the user IS allowed access.  The user shoud ALWAYS be allowed access to this page.  I suspect it is a configuration problem, so here are snippets of my web.config... <compilation debug="false" strict="true" explicit="true" /> <trace enabled="false"/> <authentication mode="Forms"> <forms protection="All" cookieless="UseCookies" requireSSL="false" slidingExpiration="false" timeout="20" name="12345678-1234-1234-1234-123456789012" loginUrl="~/Web/Login.aspx" defaultUrl="~/Web/MyPage.aspx" enableCrossAppRedirects="false" /> <authentication> <httpCookies httpOnlyCookies="true" /> <sessionState cookieless="UseCookies" />         <location path="Web/Contact.aspx"> <system.web> <authorization> <allow users="*"/> <authorization> <system.web> <location>   Can you help me figure out why users are not ALWAYS allowed access to the /Web/Contact.aspx page? Thx!      

Redirecting to login page while accessing document from document library In FBA Authentication

  
Hi all,            I have FBA site. When i open document from share point document library, it takes me to login page. After i enter credentials it will open page in client application ( ex. Microsoft word, microsoft powerpoint).   Regards Milan chauhan

Forms Authentication shared between 2 Applications, but still getting directed to login page

  
my scenario is: Single Sign-on Within a Sub Domain (two virtual directories under the same sub domain)I've setup both sites using the same forms authentication info in my web.config. both sites have the same machine key's as well. I sign into site1. i click a link that directs to site2. site2 still redirects me to the login page, however on the login page I test HttpContext.Current.User.Identity.IsAuthenticated and it returns true. I also tested on site2's login page to pull the ticket's information and it's pulling everything. so it looks like SSO is working as far as sharing the authentication ticket, yet I cannot figure out why it still puts me on the login page? site 1: https://mysub.mydomain.com/site1/ link in site1 that directs to site2: site 1: https://mysub.mydomain.com/site2/mypage.aspx any ideas? appreciate any help someone could give.

Forms Based Authentication - problem with custom master page and login page

  

Hi,

I have successfully enabled and set up FBA (Forms Based Authentication) on my SharePoint 2010 Foundation server. The thing is that I need to customize the look and feel of the login page. I have successfully customized the page (and master page) to look the way I want, however, when I try to log in, I get the following error/message on the page:
"Forms Based Authentication on classic Web applications has been deprecated".

What I've done:
Made copies of /_layouts/simple.master and /_layouts/login.aspx and renamed the copies. The markup in the master page is MUCH simpler than the original, but I've kept all the ContentPlaceholders that I don't use (most of them) in a hidden <asp:Panel at the bottom of the page.

I've changed the web.config file:
<authentication mode="Forms">
      <forms loginUrl="/_layouts/loginCustom.aspx" />
</authentication>

So, I'm not getting any errors on the page until I try to log in. When I use the default settings (login.aspx and simple.master) it works just fine (but damn that page looks ugly!).

Does anyone know what I might be missing?

Update: I believe the reason it doesn't work is because my custom login aspx is not part of the Claims Based Web Application (because it's sitting

Determine if the page required authentication?

  

I'm using Forms Authentication.  Is there a way to determine whether a page (or request) required authentication or not?  My site has logged-in areas, and logged-out areas (all set in web.config under authorization sections), and I'd like a good way to know if asp.net required authentication to be set or not.


I'm using ASP.Net 2.0


download a page lose authentication/session state

  

Hi All,

I have an issue of keeping the authentication and session state on a downloaded page, on the same website.

I have 2 pages, page 1 will download page 2, using the following code:

Page 1 code:

System.Net.WebClient webClient = new System.Net.WebClient();
byte[] buffer = webClient.DownloadData("http://www.mywebsite.co.uk/page2.aspx");
return Encoding.UTF8.GetString(buffer);


but the authentication is lost, so i needed to re-login in page 2 by writing auto login code myself.
But then the session is lost, so the session variables set in page 1 cannot be share to page 2, and vice versa.

Ideally, i needed page 2 to keep the authentication and session state when i call webClient.DownloadData()

Is there a way to do this?
Many thanks!


Authentication popup in the middle of asp.net page process

  

Hi,

I have problem where i get authentication popup rises in the middle of the page process. Let me explain the scenario in detail.


I have an asp.net application developed and hosted in intranet which is used by finance team for some monthly calculation purpose.


Since it involves calculation of huge data i just did the calculation process alone with multithreading concept and implemented the same. 

When we tried in our local and System testing environment we achieved the results in great success as the calculation took 6 minutes instead of normal 22 minutes and we happily proceded for production movement but we got stuck up in production environment with the following issue.

The moment we hit the calculation run button it started calculating and exactly after 5 mins we got a popup for authentication (it uses windows authentication) and if we give credentials it went to session timeout page. 

We thought session timeout might be an issue and we increased all the timeouts as far as we know:

 - Session timeout (gave 30 mins)

 - HTTP runtime execution timeout (1000 secs)

 - Connection timeout (sql) (300 secs)

 - Command Timeout (300 secs)


The application is hosted with the following environment

 - Windows server 2008

 - MS SQ

Not redirect to the original page in cross site authentication

  

hi,

We have multiple web applications(in one machine), we want all those  web applications to be authenticated by a single login page, that is, after logging in, you can visit any page in all those web applications. The login page is placed in a dedicated web application called Membership. The following is the config of the Membership web app.

<connectionStrings>
    <add name="MyMembershipConnString" connectionString="server=.;database=aspnetdb;trusted_connection=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>

 

<membership defaultProvider="MyMembershipProvider">
      <providers>
        <add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider"
        connectionStringName="MyMembershipConnString" enablePasswordRetrieval="false"
        enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="MyMembership"
        requiresUniqueEmail="true" passwordFormat="Clear"/>
  &nbs

Create single custom login page for Windows Authentication and Form Based Authentication.

  

I want to create a custom login page for both Windows Authentication and Form Based Authentication.

I mean to I have to create only single login page for both authentication.

How can I create this kind of page?


G. Goyal

After membership authentication,no redirection to the original page occurs.Why?

  

hi,

I am sorry. I wrote a similar post. Maybe i didn't make myself clear so nobody gives me a reply. So I rewrote my question:

We have multiple web applications(in one machine), we want all those  web applications to be authenticated by a single login page, that is, after logging in, you can visit any page in all those web applications. The login page is placed in a dedicated web application called Membership. The following is the config of the Membership web app.

<connectionStrings>
    <add name="MyMembershipConnString" connectionString="server=.;database=aspnetdb;trusted_connection=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>

 

<membership defaultProvider="MyMembershipProvider">
      <providers>
        <add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider"
        connectionStringName="MyMembershipConnString" enablePasswordRetrieval="false"
        enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="MyMembership"

Building a custom Login Page which does not use forms or windows authentication

  

Hi,

I would like to build a custom login page which doesnt uses the windows or forms authentication but I am troubled as to how I should do that. I tried to follow the default AccountController.vb file but it doesnt help me much as it doesnt show where its connecting with the database.

What is need is:

Database Table User

columns are userid, email, password

to write a login page that will use my sql server to login rather than using the forms or windows authentication


Output caching a page that requires sql authentication

  

My understanding of output caching is that a full page is rendered and available at the application server to send to any clients that may request that particular page.  So if you have 5,000 different client requests, each receives the cached page on the server, instead of 5,000 independent connections to the database to retrieve the same exact information.  Another way of looking at this is that the application server, upon an initial visit, connects to the database once, gets the data, renders the pager, and stores it for a period of time to send to any client that requests it.  It's awesomely efficient, really.

My question is what happens if the connection to the database requires authentication?  In this case, to authenticate each of the 5,000 users, must a new connection be opened to verify the user before the caching can be taken advantage of.  I hope not, but how does the application know whether or not to share the rendered page with an unauthenticated user?

Thanks,

 

Tim


Changing the graphics on the home page of a SharePoint site

  
When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor
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