2010-09-02 13 views
34

का उपयोग कर अनधिकृत उपयोगकर्ताओं के लिए विशिष्ट पृष्ठ तक पहुंच की अनुमति दें मैं एएसपी.Net फॉर्म प्रमाणीकरण का उपयोग कर रहा हूं। मेरा Web.config इस तरह दिखता है।एएसपी.Net प्रपत्र प्रमाणीकरण

<authentication mode="Forms"> 
     <forms loginUrl="login.aspx"/> 
    </authentication> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 

तो वर्तमान में प्रत्येक एएसपीएक्स पृष्ठ प्रमाणीकरण की आवश्यकता है।

मैं विशेष रूप से अनधिकृत उपयोगकर्ताओं तक विशेष.aspx नामक एक विशिष्ट पृष्ठ तक पहुंच की अनुमति देना चाहता हूं। मैं यह कैसे कर सकता हूं?

+0

क्या आपने कभी यह पता लगाया है? –

उत्तर

44

MS Support

<configuration> 
    <system.web> 
     <authentication mode="Forms" > 
      <forms loginUrl="login.aspx" name=".ASPNETAUTH" protection="None" path="/" timeout="20" > 
      </forms> 
     </authentication> 
<!-- This section denies access to all files in this 
application except for those that you have not explicitly 
specified by using another setting. --> 
     <authorization> 
      <deny users="?" /> 
     </authorization> 
    </system.web> 
<!-- This section gives the unauthenticated 
user access to the ThePageThatUnauthenticatedUsersCanVisit.aspx 
page only. It is located in the same folder 
as this configuration file. --> 
     <location path="ThePageThatUnauthenticatedUsersCanVisit.aspx"> 
     <system.web> 
     <authorization> 
      <allow users ="*" /> 
     </authorization> 
     </system.web> 
     </location> 
<!-- This section gives the unauthenticated 
user access to all of the files that are stored 
in the TheDirectoryThatUnauthenticatedUsersCanVisit folder. --> 
     <location path="TheDirectoryThatUnauthenticatedUsersCanVisit"> 
     <system.web> 
     <authorization> 
      <allow users ="*" /> 
     </authorization> 
     </system.web> 
     </location> 
</configuration> 
+0

'प्रमाणीकरण मोड =" विंडोज़ "/> के लिए इस तकनीक का उपयोग करते समय यह अनधिकृत उपयोगकर्ता को उस विशिष्ट पृष्ठ तक पहुंच की अनुमति देता है जिसे मैं चाहता हूं (" yay "), लेकिन यह अभी भी उनके प्रमाण-पत्रों के लिए संकेत देता है? आप इसे बंद कर सकते हैं और पेज को ठीक देख सकते हैं, लेकिन मैं सोच रहा हूं कि विशिष्ट पृष्ठ के लिए "प्रमाणीकरण आवश्यक" को कैसे अक्षम किया जाए? –

+0

@TrevorNestman क्या आप छवियों आदि जैसे पेज पर अन्य संपत्तियां लोड कर रहे हैं? शायद यह है कि वे प्रमाणीकरण के लिए संकेत दे रहे हैं। प्रतिक्रिया के लिए – dnolan

+0

@ डॉनोलन धन्यवाद। मैं इसे समझने में सक्षम था। मैं पूछता हूं कि वे दृश्य में किस भूमिका में थे, इसलिए मुझे पूरा यकीन है कि यह क्या संकेत दे रहा था। –

15

पर उदाहरण पर एक नजर डालें अपने web.config में निम्नलिखित रखो:

<location path="special.aspx"> 
    <system.web> 
     <authorization> 
     <allow users="*"/> 
     </authorization> 
    </system.web> 
    </location> 
2

हर किसी के लिए एक विशेष पेज

कभी-कभी आप कुछ पृष्ठ पर सार्वजनिक उपयोग की अनुमति देना चाहते हैं और साइट केवल करने के लिए लॉग इन/प्रमाणीकृत उपयोगकर्ताओं .i.e के बाकी के लिए उपयोग को प्रतिबंधित करना चाहते एक्सेस करने दें। अनाम पहुंच की अनुमति न दें। अपने विशेष .aspx को अपनी साइट के मूल फ़ोल्डर में कहें। अपनी वेबसाइट के रूट फ़ोल्डर के web.config में आपको निम्न सेटअप की आवश्यकता है।

<configuration> 
    <system.web> 

    <authentication mode="Forms"/> 

     <authorization> <deny users="?"/> //this will restrict anonymous user access 
     </authorization> 

    </system.web> 
    <location path="special.aspx"> //path here is path to your special.aspx page 
    <system.web> 
    <authorization> 
    <allow users="*"/> // this will allow access to everyone to special.aspx 

</authorization> 
</system.web> 
</location> 
</configuration> 
संबंधित मुद्दे