c# - Preventing getting to other URL of web service -
i doing web service in .net containing server file (.asmx) , client interface (.aspx). visitors should able visit client aspx site ( urlxxx:portyy/client.aspx) however, when remove "/client.aspx" part url, project directory , should not possible. (so far, running project on localhost.)
is there way, how restrict getting other parts of solution? possibility think of creating separate project client aspx site, however, visitor able directory containing site.
you should able control explicit access using web.config. have @ example (exclaimer: i've copied straight this ms page):
<configuration> <system.web> <authentication mode="forms" > <forms loginurl="login.aspx" name=".aspnetauth" protection="none" path="/" timeout="20" > </forms> </authentication> <!-- section denies access files in application except have not explicitly specified using setting. --> <authorization> <deny users="?" /> </authorization> </system.web> <!-- section gives unauthenticated user access default1.aspx page only. located in same folder configuration file. --> <location path="default1.aspx"> <system.web> <authorization> <allow users ="*" /> </authorization> </system.web> </location> <!-- section gives unauthenticated user access of files stored in subdir1 folder. --> <location path="subdir1"> <system.web> <authorization> <allow users ="*" /> </authorization> </system.web> </location> </configuration>
edit: take @ this question more info on denying access explicit folders well.
Comments
Post a Comment