Web uygulamalarında gerekli sayfaların ssl ile açılmaya zorlanması (ve diğer sayfaların cleartext olarak açılmaya zorlanması)

January 30, 2009 at 12:33 AMoozturk

Bu soruna çözüm üretmek için esasen her ssl gereken sayfanın OnInit event'ine request.IsSecureConnection değerine göre bir Response.Redirect komutu ile yönlendirmek yeter. Ancak her sayfa için bunu yapana kadar hele hele bir de response.redirect diye yapılacak yönlendirme için sürekli if conditionlar ile yorulana kadar daha kolay bir çözüm bulmak daha mantıklı geliyor kulağa.

 

Bunun için internette arama yaparken güzel bir çözüm buldum. Keith Brown tarafından yazılmış olan SslHelper - Get help running a partial SSL website in ASP.NET adlı makalede güzel bir çözüm var. Bu çözümü biraz modifiye ettim ve aşağıdaki gibi bir çözüm daha kolay oldu.

 

Adımlara bakalım 

1.  Aşağıdaki dosyayı uygulamanıza ekleyin.

   PageBases.cs (3,00 kb)

2. SSL istediğiniz sayfalara şu ayarı yapın.

   Kod görünümündeki sayfanın class tanımlama satırındaki Page (System.Web.UI.Page) değeri yerine SecurePage yazın

3. SSL istemediğiniz sayfalara şu ayarı yapın.

   Kod görünümündeki sayfanın class tanımlama satırındaki Page (System.Web.UI.Page) değeri yerine PlainPage yazın 

4. Test edin.

   Visual studio'nun web server'ının SSL desteği yoktur. Bu sebeple eğer bu özelliği kullanıyorsanız sayfa açılmayacaktır! Visual Studio ile SSL sayfalarına sahip bir web uygulamasının debug için ayarlanması (Visual Studio Web Server'ın https yani ssl bağlantılarını kabul etmesinin sağlanması) yazımı okursanız, bu soruna da kolaylıkla çözüm bulabilirsiniz.

 

Posted in: ASP.NET

Tags: , , , , , , ,

Comments (36) -

Teşekkürler yalnız build ederken hata veriyor.Bu enhanced page classını nerden import etmemiz gerekiyor.

Reply

You are probably sick of reading it, but you have got a really well written blog. Keep up the the great blog.  

Reply

I definitely agree with most of the other comments. I really enjoy reading your blog.

Reply

Quite Good Blogpost. Would you thoughts if I take a tiny snippets of your article and needless to say link it to your blogposts??

Reply

I have recently started using the blogengine.net and I having some problems here? in your blog you stated that we need to enable write permissions on the App_Data folder...unfortunately I don't understand how to enable it.

Reply

Wonderful learn, I simply passed this onto a colleague who was in search of this info. I've you bookmarked on Digg.

Reply

That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such helpful information here.

Reply

I was looking for crucial information on this subject. The information was important as I am about to launch my own portal. Thanks for providing a missing link in my business.

Reply

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon

Reply

I learn something new on different blogs everyday. It is always refreshing to read posts of other bloggers and learn something from them. Thanks for sharing.

Reply

I must say that overall I am very taken with this site. It is apparent that you know you subject matter and you are passionate about it. I wish I had got your ability to write. I have bookmarked your site and look forward to more updates.

Reply

I like the approach you took with this topic. It's not typical that you just discover something so concise and informative.

Reply

thank you for the info.. much appreciated .

Reply

We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

Reply

Tremendous blog. I'll have to remember to check back again.

Reply

This is a good,common sense article.Very helpful to one who is just finding the resouces about this part.It will certainly help educate me.

Reply

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks

Reply

Good share, great article, very usefull for us…thanks.

Reply

I hope you never stop!  This is one of the best blogs Ive ever read.  Youve got some mad skill here, man.  I just hope that you dont lose your style because youre definitely one of the coolest bloggers out there.  Please keep it up because the internet needs someone like you spreading the word.

Reply

I just signed up to your RSS feed after reading this post! {Will you be writing|Can you write more dealing with|regarding|about this in future articles?

Reply

great blog! keep up the great work!

Reply

Hi, I read a couple of your great posted posts and wanted to ask if you would be interested in exchanging pages?

Reply

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

Reply

Awesome information, many thanks to the writer. It truly is comprehensible to me now, the effectiveness and value is overwhelming. Thanks once more and good luck!

Reply

This site needs to be cleaned up a bit. Too many unrelated things being said. Please do something!

Reply

I have found this amazing blog article ,and I should say to you thank you very much for giving this one to us.

Reply

Good work, keep us posting, you are good writer.

Reply

I appreciate what you have prepared in this article. I enjoy the piece in which you point out you do this in order to give back but I would certainly assume by all the commentary that this is working for you as well.

Reply

You're not going to believe this but I have wasted all day hunting for some articles about this. I wish I knew of this site earlier, it was a fantastic read and really helped me out. Have a good one

Reply

Quite possibly the most helpful as well as current facts I recently found on that subject. I am sure delighted that I uncovered the article by chance. I’ll probably be opting-in for your rss feed in order that I'm able to obtain the current updates. Like all the stuff here.

Reply

Very interesting. Do you have a facebook or twitter page I can follow you on?

Reply

Very good post. I'd like to use some of this information on my blog if you don't mind, and I'll provide a link back to your site. I'll also be subscring to your RSS feed.

Reply

I kinda found this blog by accident, but your blog caught my eye and I thought that I would comment to let you know that I like it.

Reply

I am sure you have spent a lot of time to give this hight quality article to us. I don't know how to thank you.

Reply

Have you considered adding some videos to your article? I think it will really enhance my understanding.

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading