Hi All,

I'm new to Blog concepts.Is it possible to post the comments to website using the webservice instead of directly post the comments in website. Any help can welcome.

Dani AI

Generated

Short answer: yes — comments can be posted to an ASP.NET blog through a web service. As hinted, use the blog engine's API if it already exposes one; otherwise create a small REST endpoint that validates, sanitizes, and persists incoming comment DTOs (postId, author, email, content, parentId, etc.).

When building the endpoint, keep these practical points in mind:

  • Validate and sanitize all inputs server side to prevent XSS and injection attacks. See the OWASP input-validation guidance for patterns to follow (OWASP Input Validation Cheat Sheet).
  • Authenticate or authorize callers that should bypass moderation (API key, OAuth/JWT) and apply rate limits for public endpoints. Log IP/user-agent and queue comments for moderation when appropriate.
  • If the client is a browser on a different origin, enable CORS carefully (allow only trusted origins). For modern guidance on building Web APIs in ASP.NET, see the Microsoft Web API docs (ASP.NET Web API / ASP.NET Core Web API).

A minimal controller flow looks like:

[HttpPost("api/comments")]
public async Task<IActionResult> PostComment([FromBody] CommentDto dto)
{
    if (!ModelState.IsValid) return BadRequest(ModelState);
    // sanitize, spam-check, persist, set moderation flag as needed
    return CreatedAtAction(nameof(GetComment), new { id = saved.Id }, saved);
}

Troubleshooting tips: check model-state and server logs if comments vanish; confirm CORS and authentication tokens; and test with a small client that posts JSON to the endpoint before wiring up UI. Ignore unrelated/spam replies such as .

Recommended Answers

All 2 Replies

Hi All,

I'm new to Blog concepts.Is it possible to post the comments to website using the webservice instead of directly post the comments in website. Any help can welcome.

You have to use concern Blog API.

Read this article feel good, I learned a lot, <ahref="">louisvuitton</a>I feel good this site, I will come back later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.