Как отключить окно “Security Alert” в управлении Webbrowser

Необходимо сделать что-то как, я сделал:

серверный код:

Основной компонент:

const express = require('express');
const server = express();
const path = require('path');   
const tweets = require ('./tweets')
const distFolder = path.join(__dirname, '../my-app/build')

server.use("/api/tweets", tweets, function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  next();
}
)

server.use(express.static(distFolder))

server.listen(process.env.PORT || 9090)

tweets.js компонент:

    router.get('/', (req, res) => {
  client.get('statuses/user_timeline', params, function(error, tweets, response) {    
    if (!error) {     
      res.send(tweets);          
    } 
    else {
      res.status(500).json({ error: error });
    }}
  )})

Теперь я могу сделать ПОЛУЧЕНИЕ к/api/post, и экспресс будет перенаправлен к client.get и возвратит твиты.

Посмотрите, что мой Реагировать Компонент:

lass Notifications extends Component {
  constructor(props) {
    super(props);

    this.state = {
      hits: [],
      isLoading: false,
      error: null,
    };
  }

  componentDidMount() {
    this.setState({ isLoading: true });

    Axios.get('http://127.0.0.1:9090/api/tweets'
    ,{
     headers: {
      'Access-Control-Allow-Origin': '*',          
     }}
    )   
    .then(result => this.setState({
        hits: result.data,
        isLoading: false
    }))
    .catch(e => console.log(e));
  }
    render() {    
const { hits, isLoading } = this.state;    
if (isLoading) {
  return (
    <div className='feed_main'>       
          <h2 className="js-ariaTitle">
            Loading...
          </h2>
        </div>
  )
}
else {
  return hits.map((data) =>    
    <div className='feed_main'>
      <strong className="fullname">{data.user.name}</strong>
      <article
        key={data.id}
      >{data.text}
      </article>
      <br />          
        </div>
      )
    }
  }
}    

export default Notifications;
9
задан Marek Grzenkowicz 26 December 2011 в 02:40
поделиться

2 ответа

Это должно сделать это:

public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    return true;
}

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);

Очевидно, ослепляюще разрешение сертификатов является угрозой безопасности. Будьте осторожны.

4
ответ дан 3 November 2019 в 00:05
поделиться

Хорошо, статья произошла на проекте кода - видят http://www.codeproject.com/KB/shell/WebBrowserControlDialogs.aspx, Надо надеяться, это помогает.

6
ответ дан 3 November 2019 в 00:05
поделиться
Другие вопросы по тегам:

Похожие вопросы: