Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default ASP.NET and SSL

    English:
    Hi! I have a problem when I send a request from an asp page toanother with HttpWebRequest. The site requires a certicate toaccess, for this reason I added a certificate to the requestusing the class X509Certificate. The problem is that I get a 403forbidden error message. I guess that is a permission matter. Ialso tried to create a component service to do it, but I obtainthe same error message. You have the code here, thanks inadvance.

    Spanish:
    Hola! Tengo un problema al enviar una petici?n de una p?gina aspa otra con HttpWebRequest. El sitio requiere de certificadospara poder entrar, as? que a la petici?n le a?ado un certificadopara que me permita abrir la p?gina asp. El problema es que meda un error 403 de prohibido. Supongo que ser? por alg?n tema depermisos pero no se solucionarlo. Tambi?n he intentado crear unservicio de componente que lo haga, pero me da el mismo error.Aqu? os dejo el c?digo para ver si le podeis echar un vistazo.

    The code:

    Dim datos, respuesta As String
    Dim webReq As HttpWebRequest
    Dim webResp As HttpWebResponse
    Dim sw As Stream
    Dim sr As StreamReader
    Dim encodedData As New ASCIIEncoding

    webReq = HttpWebRequest.Create(url)
    webReq.Method = "POST"
    webReq.Timeout = 60000
    webReq.ContentLength = byteArray.Length
    webReq.ContentType = "application/x-www-form-urlencoded"

    Dim cert = X509Certificate.CreateFromCertFile(pathcertificado )
    webReq.ClientCertificates.Add(cert)

    webReq.AllowWriteStreamBuffering = False
    sw = webReq.GetRequestStream()
    sw.Write(byteArray, 0, byteArray.Length)
    sw.Close()

    'Obtenemos la respuesta del servidor
    webResp = webReq.GetResponse()
    sr = New StreamReader(webResp.GetResponseStream())
    respuesta = sr.ReadToEnd()
    sr.Close()



    Gracias. Thanks
    From: Jalyah TL

    -----------------------
    Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])

    <Id>ecZR6QfZqE6zKK1zynJjRQ==</Id>
    Jalyah TL via .NET 247 Guest

  2. #2

    Default Asp.Net and SSL

    I'm making an ASP.Net website using forms authentication. I want to force all
    users to use SSL when using this application. I know that I can specify in
    IIS to force the app to have SSL but I can't do my testing when I do this. Is
    this the best way to accomplish this or is there a better way?
    SubstandardSnowman Guest

  3. #3

    Default Re: Asp.Net and SSL

    Why can't you do your testing with this setting on?

    Cheers
    Ken

    "SubstandardSnowman" <SubstandardSnowman@discussions.microsoft.com> wrote in
    message news:594574C1-8106-4FF7-AF9F-1F2769E524F8@microsoft.com...
    > I'm making an ASP.Net website using forms authentication. I want to force
    > all
    > users to use SSL when using this application. I know that I can specify in
    > IIS to force the app to have SSL but I can't do my testing when I do this.
    > Is
    > this the best way to accomplish this or is there a better way?

    Ken Schaefer Guest

  4. #4

    Default Re: Asp.Net and SSL

    If I turn this setting on then I can't open the project with VS.NET. I was
    hoping to just be able to have it on all the time or some other method to
    always force SSL but if this is not possible then I would just like to know.

    "Ken Schaefer" wrote:
    > Why can't you do your testing with this setting on?
    >
    > Cheers
    > Ken
    >
    > "SubstandardSnowman" <SubstandardSnowman@discussions.microsoft.com> wrote in
    > message news:594574C1-8106-4FF7-AF9F-1F2769E524F8@microsoft.com...
    > > I'm making an ASP.Net website using forms authentication. I want to force
    > > all
    > > users to use SSL when using this application. I know that I can specify in
    > > IIS to force the app to have SSL but I can't do my testing when I do this.
    > > Is
    > > this the best way to accomplish this or is there a better way?
    >
    >
    >
    SubstandardSnowman Guest

  5. #5

    Default Re: Asp.Net and SSL

    You can open web projects in VStudio even if their corresponding virtual
    directories force use of SSL. You simply need to adjust the URLs used by
    VStudio to refer to your project. For instructions, see
    [url]http://groups.google.com/groups?threadm=unzN3btLEHA.3664%40TK2MSFTNGP10.phx .gbl&rnum=4[/url].

    You can also test an application under SSL even if IIS doesn't force SSL
    use. As long as there's an appopriate certificate installed and an SSL port
    mapped, you can use an https address to reach your pages even if you're not
    forcing SSL.

    HTH,
    Nicole



    "SubstandardSnowman" <SubstandardSnowman@discussions.microsoft.com> wrote in
    message news:777B43C9-49C9-4B1D-9626-231BE6AD0633@microsoft.com...
    > If I turn this setting on then I can't open the project with VS.NET. I was
    > hoping to just be able to have it on all the time or some other method to
    > always force SSL but if this is not possible then I would just like to
    > know.
    >
    > "Ken Schaefer" wrote:
    >
    >> Why can't you do your testing with this setting on?
    >>
    >> Cheers
    >> Ken
    >>
    >> "SubstandardSnowman" <SubstandardSnowman@discussions.microsoft.com> wrote
    >> in
    >> message news:594574C1-8106-4FF7-AF9F-1F2769E524F8@microsoft.com...
    >> > I'm making an ASP.Net website using forms authentication. I want to
    >> > force
    >> > all
    >> > users to use SSL when using this application. I know that I can specify
    >> > in
    >> > IIS to force the app to have SSL but I can't do my testing when I do
    >> > this.
    >> > Is
    >> > this the best way to accomplish this or is there a better way?
    >>
    >>
    >>

    Nicole Calinoiu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139